@message.message_read = message_read
if @message.save
flash[:notice] = notice
- redirect_back_or_to inbox_messages_path, :status => :see_other
+ redirect_to inbox_messages_path, :status => :see_other
end
rescue ActiveRecord::RecordNotFound
@title = t "messages.no_such_message.title"
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