Fix tests

This commit is contained in:
Jorge Manrubia
2025-09-29 13:13:40 +02:00
parent 859a016a2e
commit 1bb8de8564
14 changed files with 552 additions and 165 deletions
@@ -21,12 +21,6 @@ class Card::Eventable::SystemCommenterTest < ActiveSupport::TestCase
end
end
test "card_staged" do
assert_system_comment "David moved this to In progress" do
@card.change_stage_to workflow_stages(:qa_in_progress)
end
end
test "card_closed" do
assert_system_comment "Closed as Done by David" do
@card.close
-12
View File
@@ -1,12 +0,0 @@
require "test_helper"
class Card::StagedTest < ActiveSupport::TestCase
setup { Current.session = sessions(:david) }
test "change stage" do
assert_difference -> { Event.where(action: :card_staged).count }, +1 do
cards(:logo).change_stage_to(workflow_stages(:qa_in_progress))
assert_equal workflow_stages(:qa_in_progress), cards(:logo).reload.stage
end
end
end
+3 -3
View File
@@ -71,11 +71,11 @@ class CardTest < ActiveSupport::TestCase
end
test "open" do
assert_equal cards(:logo, :layout, :text), Card.open
assert_equal cards(:logo, :layout, :text, :buy_domain), Card.open
end
test "card_unassigned" do
assert_equal cards(:shipping, :text), Card.unassigned
assert_equal cards(:shipping, :text, :buy_domain), Card.unassigned
end
test "assigned to" do
@@ -88,7 +88,7 @@ class CardTest < ActiveSupport::TestCase
test "in collection" do
new_collection = Collection.create! name: "New Collection", creator: users(:david)
assert_equal cards(:logo, :shipping, :layout, :text), Card.where(collection: collections(:writebook))
assert_equal cards(:logo, :shipping, :layout, :text, :buy_domain), Card.where(collection: collections(:writebook))
assert_empty Card.where(collection: new_collection)
end
@@ -1,13 +0,0 @@
require "test_helper"
class Collection::WorkflowingTest < ActiveSupport::TestCase
test "change all card stages when changing workflow" do
collections(:writebook).update! workflow: workflows(:on_call)
assert_equal [ collections(:writebook).initial_workflow_stage ], collections(:writebook).cards.reload.collect(&:stage).uniq
end
test "remove stage from cards if workflow is removed" do
collections(:writebook).update! workflow: nil
assert_equal [], collections(:writebook).cards.reload.collect(&:stage).compact
end
end
-2
View File
@@ -5,11 +5,9 @@ class FilterTest < ActiveSupport::TestCase
Current.set session: sessions(:david) do
@new_collection = Collection.create! name: "Inaccessible Collection"
@new_card = @new_collection.cards.create!
@new_card.update!(stage: workflow_stages(:qa_on_hold))
cards(:layout).comments.create!(body: "I hate haggis")
cards(:logo).comments.create!(body: "I love haggis")
cards(:logo).update(stage: workflow_stages(:qa_on_hold))
end
assert_not_includes users(:kevin).filters.new.cards, @new_card