]> git.openstreetmap.org Git - rails.git/blobdiff - test/controllers/messages_controller_test.rb
Replace "Login" labels with "Log in" when used as a verb
[rails.git] / test / controllers / messages_controller_test.rb
index 1193d3b25ec90187279e63b4ecb7a1d84dace48a..0bc031cb4b48c5ab11e9447abd4d420bf25d2b77 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
@@ -245,7 +245,7 @@ class MessagesControllerTest < ActionDispatch::IntegrationTest
     # Check that we can't reply to somebody else's message
     get message_reply_path(:message_id => unread_message)
     assert_redirected_to login_path(:referer => message_reply_path(:message_id => unread_message.id))
-    assert_equal "You are logged in as `#{other_user.display_name}' but the message you have asked to reply to was not sent to that user. Please login as the correct user in order to reply.", flash[:notice]
+    assert_equal "You are logged in as `#{other_user.display_name}' but the message you have asked to reply to was not sent to that user. Please log in as the correct user in order to reply.", flash[:notice]
 
     # Login as the right user
     session_for(recipient_user)
@@ -291,7 +291,7 @@ class MessagesControllerTest < ActionDispatch::IntegrationTest
     # Check that we can't read the message
     get message_path(:id => unread_message)
     assert_redirected_to login_path(:referer => message_path(:id => unread_message.id))
-    assert_equal "You are logged in as `#{other_user.display_name}' but the message you have asked to read was not sent by or to that user. Please login as the correct user in order to read it.", flash[:notice]
+    assert_equal "You are logged in as `#{other_user.display_name}' but the message you have asked to read was not sent by or to that user. Please log in as the correct user in order to read it.", flash[:notice]
 
     # Login as the message sender
     session_for(user)
@@ -413,7 +413,6 @@ class MessagesControllerTest < ActionDispatch::IntegrationTest
 
     # Asking to mark a message with no ID should fail
     post message_mark_path
-    assert_response :redirect
     assert_redirected_to inbox_messages_path
 
     # Asking to mark a message with a bogus ID should fail
@@ -464,7 +463,6 @@ class MessagesControllerTest < ActionDispatch::IntegrationTest
 
     # Asking to destroy a message with no ID should fail
     delete message_path
-    assert_response :redirect
     assert_redirected_to inbox_messages_path
 
     # Asking to destroy a message with a bogus ID should fail
@@ -472,15 +470,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