unread_button: "Mark as unread"
read_button: "Mark as read"
reply_button: "Reply"
- delete_button: "Delete"
+ destroy_button: "Delete"
new:
title: "Send message"
send_message_to: "Send a new message to %{name}"
date: "Date"
reply_button: "Reply"
unread_button: "Mark as unread"
- delete_button: "Delete"
+ destroy_button: "Delete"
back: "Back"
to: "To"
wrong_user: "You are logged in as `%{user}' 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."
sent_message_summary:
- delete_button: "Delete"
+ destroy_button: "Delete"
mark:
as_read: "Message marked as read"
as_unread: "Message marked as unread"
- delete:
- deleted: "Message deleted"
+ destroy:
+ destroyed: "Message deleted"
site:
about:
next: Next
)
assert_routing(
{ :path => "/message/delete/1", :method => :post },
- { :controller => "messages", :action => "delete", :message_id => "1" }
+ { :controller => "messages", :action => "destroy", :message_id => "1" }
)
end
end
##
- # test the delete action
- def test_delete
+ # test the destroy action
+ def test_destroy
user = create(:user)
second_user = create(:user)
other_user = create(:user)
read_message = create(:message, :read, :recipient => user, :sender => second_user)
sent_message = create(:message, :unread, :recipient => second_user, :sender => user)
- # Check that the deleting a message requires us to login
- post :delete, :params => { :message_id => read_message.id }
+ # Check that destroying a message requires us to login
+ post :destroy, :params => { :message_id => read_message.id }
assert_response :forbidden
# Login as a user with no messages
session[:user] = other_user.id
- # Check that deleting a message we didn't send or receive fails
- post :delete, :params => { :message_id => read_message.id }
+ # Check that destroying a message we didn't send or receive fails
+ post :destroy, :params => { :message_id => read_message.id }
assert_response :not_found
assert_template "no_such_message"
# Login as the message recipient_user
session[:user] = user.id
- # Check that the deleting a received message works
- post :delete, :params => { :message_id => read_message.id }
+ # Check that the destroy a received message works
+ post :destroy, :params => { :message_id => read_message.id }
assert_redirected_to inbox_path(:display_name => user.display_name)
assert_equal "Message deleted", flash[:notice]
m = Message.find(read_message.id)
assert_equal true, m.from_user_visible
assert_equal false, m.to_user_visible
- # Check that the deleting a sent message works
- post :delete, :params => { :message_id => sent_message.id, :referer => outbox_path(:display_name => user.display_name) }
+ # Check that the destroying a sent message works
+ post :destroy, :params => { :message_id => sent_message.id, :referer => outbox_path(:display_name => user.display_name) }
assert_redirected_to outbox_path(:display_name => user.display_name)
assert_equal "Message deleted", flash[:notice]
m = Message.find(sent_message.id)
assert_equal false, m.from_user_visible
assert_equal true, m.to_user_visible
- # Asking to delete a message with no ID should fail
+ # Asking to destroy a message with no ID should fail
assert_raise ActionController::UrlGenerationError do
- post :delete
+ post :destroy
end
- # Asking to delete a message with a bogus ID should fail
- post :delete, :params => { :message_id => 99999 }
+ # Asking to destroy a message with a bogus ID should fail
+ post :destroy, :params => { :message_id => 99999 }
assert_response :not_found
assert_template "no_such_message"
end