]> git.openstreetmap.org Git - rails.git/blobdiff - test/controllers/messages_controller_test.rb
Merge remote-tracking branch 'upstream/pull/4272'
[rails.git] / test / controllers / messages_controller_test.rb
index 1193d3b25ec90187279e63b4ecb7a1d84dace48a..fcfc8da5e30cfb2fcf30bafac9a1e7094e3c965f 100644 (file)
@@ -214,13 +214,13 @@ class MessagesControllerTest < ActionDispatch::IntegrationTest
     # Check that sending a message fails when the message limit is hit
     assert_no_difference "ActionMailer::Base.deliveries.size" do
       assert_no_difference "Message.count" do
-        with_message_limit(0) do
+        with_settings(:max_messages_per_hour => 0) do
           perform_enqueued_jobs do
             post messages_path(:display_name => recipient_user.display_name,
                                :message => { :title => "Test Message", :body => "Test message body" })
             assert_response :success
             assert_template "new"
-            assert_select ".error", /wait a while/
+            assert_select ".alert.alert-danger", /wait a while/
           end
         end
       end
@@ -472,15 +472,4 @@ class MessagesControllerTest < ActionDispatch::IntegrationTest
     assert_response :not_found
     assert_template "no_such_message"
   end
-
-  private
-
-  def with_message_limit(value)
-    max_messages_per_hour = Settings.max_messages_per_hour
-    Settings.max_messages_per_hour = value
-
-    yield
-
-    Settings.max_messages_per_hour = max_messages_per_hour
-  end
 end