Remove unused Card.published_or_drafted_by scope
As the tests for it could lead to confusion where it seems drafted cards are not accessible to someone with access to the board and with the direct drafted card URL.
This commit is contained in:
committed by
Rosa Gutierrez
parent
32a0acea11
commit
cb01966439
@@ -6,8 +6,6 @@ module Card::Statuses
|
||||
|
||||
before_save :mark_if_just_published
|
||||
after_create -> { track_event :published }, if: :published?
|
||||
|
||||
scope :published_or_drafted_by, ->(user) { where(status: :published).or(where(status: :drafted, creator: user)) }
|
||||
end
|
||||
|
||||
attr_accessor :was_just_published
|
||||
|
||||
@@ -11,22 +11,6 @@ class Card::StatusesTest < ActiveSupport::TestCase
|
||||
assert card.drafted?
|
||||
end
|
||||
|
||||
test "cards are only visible to the creator when drafted" do
|
||||
card = boards(:writebook).cards.create! creator: users(:kevin), title: "Drafted Card"
|
||||
card.drafted!
|
||||
|
||||
assert_includes Card.published_or_drafted_by(users(:kevin)), card
|
||||
assert_not_includes Card.published_or_drafted_by(users(:jz)), card
|
||||
end
|
||||
|
||||
test "cards are visible to everyone when published" do
|
||||
card = boards(:writebook).cards.create! creator: users(:kevin), title: "Published Card"
|
||||
card.published!
|
||||
|
||||
assert_includes Card.published_or_drafted_by(users(:kevin)), card
|
||||
assert_includes Card.published_or_drafted_by(users(:jz)), card
|
||||
end
|
||||
|
||||
test "an event is created when a card is created in the published state" do
|
||||
assert_no_difference(-> { Event.count }) do
|
||||
boards(:writebook).cards.create! creator: users(:kevin), title: "Draft Card"
|
||||
|
||||
Reference in New Issue
Block a user