]> git.openstreetmap.org Git - rails.git/blob - test/models/user_mute_test.rb
Add validation for maximum ID passed to changesets#index
[rails.git] / test / models / user_mute_test.rb
1 require "test_helper"
2
3 class UserMuteTest < ActiveSupport::TestCase
4   def test_messages_by_muted_users_are_muted
5     user = create(:user)
6     muted_user = create(:user)
7     create(:user_mute, :owner => user, :subject => muted_user)
8
9     message = create(:message, :sender => muted_user, :recipient => user)
10     assert_predicate message, :muted?
11   end
12
13   def test_messages_by_admins_or_moderators_are_never_muted
14     user = create(:user)
15
16     [create(:administrator_user), create(:moderator_user)].each do |admin_or_moderator|
17       create(:user_mute, :owner => user, :subject => admin_or_moderator)
18
19       message = create(:message, :sender => admin_or_moderator, :recipient => user)
20
21       assert_not_predicate message, :muted?
22     end
23   end
24 end