3 class UserMutesControllerTest < ActionDispatch::IntegrationTest
6 { :path => "/user/username/mute", :method => :post },
7 { :controller => "user_mutes", :action => "create", :display_name => "username" }
10 { :path => "/user/username/mute", :method => :delete },
11 { :controller => "user_mutes", :action => "destroy", :display_name => "username" }
14 { :path => "/user_mutes", :method => :get },
15 { :controller => "user_mutes", :action => "index" }
21 user.mutes.create(:subject => create(:user))
25 assert_match "You have muted 1 User", @response.body
32 assert_equal 0, user.muted_users.count
33 subject = create(:user, :display_name => "Bob")
34 post user_mute_path(subject)
35 assert_match "You muted Bob", flash[:notice]
37 assert_equal 1, user.muted_users.count
38 assert_equal subject, user.muted_users.first
40 post user_mute_path(subject)
41 assert_match "Bob could not be muted. Is already muted", flash[:error]
42 assert_equal 1, user.muted_users.count
49 subject = create(:user, :display_name => "Bob")
50 user.mutes.create(:subject => subject)
51 assert_equal 1, user.muted_users.count
53 delete user_mute_path(subject)
54 assert_match "You unmuted Bob", flash[:notice]
55 assert_equal 0, user.muted_users.count
57 delete user_mute_path(subject)
58 assert_response :not_found