Skip to content

Commit

Permalink
Refactor tests a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
jsuchal committed Dec 4, 2023
1 parent 972ca99 commit 3c99795
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions test/models/message_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,18 @@ class MessageTest < ActiveSupport::TestCase
end

test "remove_cascade_tag method should delete tag from message and also message thread if no more messages with the tag" do
message = messages(:solver_main_delivery_notification_one)
tag = tags(:solver_delivery_notification)
message = messages(:ssd_main_general_one)
tag = tags(:ssd_finance)

message.add_cascading_tag(tag)

assert message.tags.include?(tag)
assert message.thread.tags.include?(tag)

message.remove_cascading_tag(tag)

assert_equal message.tags.include?(tag), false
assert_equal message.thread.tags.include?(tag), false
assert_not message.tags.include?(tag)
assert_not message.thread.tags.include?(tag)
end

test "remove_cascade_tag method should delete tag from message and keep it on message thread if more messages with the tag" do
Expand All @@ -27,7 +32,7 @@ class MessageTest < ActiveSupport::TestCase

message.remove_cascading_tag(tag)

assert_equal message.tags.include?(tag), false
assert_not message.tags.include?(tag)
assert message.thread.tags.include?(tag)
end
end

0 comments on commit 3c99795

Please sign in to comment.