- # Check that the marking a message read via XHR works
- post :mark, :xhr => true, :params => { :message_id => unread_message.id, :mark => "read" }
- assert_response :success
- assert_template "mark"
- assert_equal true, Message.find(unread_message.id).message_read
-
- # Check that the marking a message unread via XHR works
- post :mark, :xhr => true, :params => { :message_id => unread_message.id, :mark => "unread" }
- assert_response :success
- assert_template "mark"
- assert_equal false, Message.find(unread_message.id).message_read
+ # Check that the marking a message read works and redirects to inbox from the message page
+ post message_mark_path(message, :mark => "read"), :headers => { :referer => message_path(message) }
+ assert_redirected_to inbox_messages_path
+ assert Message.find(message.id).message_read