]> git.openstreetmap.org Git - rails.git/blobdiff - test/controllers/messages_controller_test.rb
Redirect to inbox after marking a message as read/unread disregarding referer
[rails.git] / test / controllers / messages_controller_test.rb
index 8fc7d35d2df2cbab7b219ea45786420df19546e2..4a48ebbbe291e37e657b1288878ced15382f925f 100644 (file)
@@ -407,14 +407,14 @@ class MessagesControllerTest < ActionDispatch::IntegrationTest
     assert_redirected_to inbox_messages_path
     assert_not Message.find(message.id).message_read
 
-    # Check that the marking a message read via XHR works
-    post message_mark_path(:message_id => message, :mark => "read")
-    assert_response :see_other
+    # Check that the marking a message read works and redirects to inbox from the message page
+    post message_mark_path(:message_id => message, :mark => "read"), :headers => { :referer => message_path(message) }
+    assert_redirected_to inbox_messages_path
     assert Message.find(message.id).message_read
 
-    # Check that the marking a message unread via XHR works
-    post message_mark_path(:message_id => message, :mark => "unread")
-    assert_response :see_other
+    # Check that the marking a message unread works and redirects to inbox from the message page
+    post message_mark_path(:message_id => message, :mark => "unread"), :headers => { :referer => message_path(message) }
+    assert_redirected_to inbox_messages_path
     assert_not Message.find(message.id).message_read
 
     # Asking to mark a message with no ID should fail