]> git.openstreetmap.org Git - rails.git/blobdiff - test/models/message_test.rb
Add tests & factories for UserMute feature
[rails.git] / test / models / message_test.rb
index 97afad56e17f80c72ec2f71add8c9f03146fb4c3..83cc1251d02d05a8465e802cb34727c029579cdb 100644 (file)
@@ -175,6 +175,26 @@ class MessageTest < ActiveSupport::TestCase
     assert_equal "text", message.body_format
   end
 
+  def test_notify_recipient
+    message = create(:message)
+    assert_not_predicate message, :muted?
+    assert_predicate message, :notify_recipient?
+  end
+
+  def test_notify_recipient_for_muted_messages
+    message = create(:message, :muted)
+    assert_predicate message, :muted?
+    assert_not_predicate message, :notify_recipient?
+  end
+
+  def test_unmuting_a_muted_message
+    message = create(:message, :muted)
+    assert_predicate message, :muted?
+
+    message.unmute
+    assert_not_predicate message, :muted?
+  end
+
   private
 
   def make_message(char, count)