X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/b70da7b8ea15ab48bb2f34155567cea6dffc8fc9..0a10ac2e9be4246987951eea86ae201f14c65fc1:/test/controllers/messages_controller_test.rb diff --git a/test/controllers/messages_controller_test.rb b/test/controllers/messages_controller_test.rb index c3d764578..4897e52bb 100644 --- a/test/controllers/messages_controller_test.rb +++ b/test/controllers/messages_controller_test.rb @@ -191,7 +191,7 @@ class MessagesControllerTest < ActionDispatch::IntegrationTest m = Message.last assert_equal user.id, m.from_user_id assert_equal recipient_user.id, m.to_user_id - assert_in_delta Time.now, m.sent_on, 2 + assert_in_delta Time.now.utc, m.sent_on, 2 assert_equal "Test Message", m.title assert_equal "Test message body", m.body assert_equal "markdown", m.body_format @@ -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 @@ -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