assert_equal "[OpenStreetMap] Test Message", e.subject
assert_match(/Test message body/, e.text_part.decoded)
assert_match(/Test message body/, e.html_part.decoded)
- assert_match %r{#{SERVER_URL}/messages/[0-9]+}, e.text_part.decoded
+ assert_match %r{#{Settings.server_url}/messages/[0-9]+}, e.text_part.decoded
ActionMailer::Base.deliveries.clear
m = Message.last
assert_equal user.id, m.from_user_id
assert_select "textarea#message_body", :count => 1
assert_select "input[type='submit'][value='Send']", :count => 1
end
- assert_equal true, Message.find(unread_message.id).message_read
+ assert Message.find(unread_message.id).message_read
# Asking to reply to a message with no ID should fail
assert_raise ActionController::UrlGenerationError do
get :show, :params => { :id => unread_message.id }
assert_response :success
assert_template "show"
- assert_equal false, Message.find(unread_message.id).message_read
+ assert_not Message.find(unread_message.id).message_read
# Login as the message recipient
session[:user] = recipient_user.id
get :show, :params => { :id => unread_message.id }
assert_response :success
assert_template "show"
- assert_equal true, Message.find(unread_message.id).message_read
+ assert Message.find(unread_message.id).message_read
# Asking to read a message with no ID should fail
assert_raise ActionController::UrlGenerationError do
get :inbox
assert_response :success
assert_template "inbox"
- assert_select "table.messages", :count => 1 do
+ assert_select ".content-inner > table", :count => 1 do
assert_select "tr", :count => 2
assert_select "tr#inbox-#{read_message.id}.inbox-row", :count => 1
end
get :outbox
assert_response :success
assert_template "outbox"
- assert_select "table.messages", :count => 1 do
+ assert_select ".content-inner > table", :count => 1 do
assert_select "tr", :count => 2
assert_select "tr.inbox-row", :count => 1
end
# Check that the marking a message read works
post :mark, :params => { :message_id => unread_message.id, :mark => "read" }
assert_redirected_to inbox_messages_path
- assert_equal true, Message.find(unread_message.id).message_read
+ assert Message.find(unread_message.id).message_read
# Check that the marking a message unread works
post :mark, :params => { :message_id => unread_message.id, :mark => "unread" }
assert_redirected_to inbox_messages_path
- assert_equal false, Message.find(unread_message.id).message_read
+ assert_not Message.find(unread_message.id).message_read
# 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
+ assert 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
+ assert_not Message.find(unread_message.id).message_read
# Asking to mark a message with no ID should fail
assert_raise ActionController::UrlGenerationError do
assert_redirected_to inbox_messages_path
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
+ assert m.from_user_visible
+ assert_not m.to_user_visible
# Check that the destroying a sent message works
delete :destroy, :params => { :id => sent_message.id, :referer => outbox_messages_path }
assert_redirected_to outbox_messages_path
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
+ assert_not m.from_user_visible
+ assert m.to_user_visible
# Asking to destroy a message with no ID should fail
assert_raise ActionController::UrlGenerationError do
private
def with_message_limit(value)
- max_messages_per_hour = Object.send("remove_const", "MAX_MESSAGES_PER_HOUR")
- Object.const_set("MAX_MESSAGES_PER_HOUR", value)
+ max_messages_per_hour = Settings.max_messages_per_hour
+ Settings.max_messages_per_hour = value
yield
- Object.send("remove_const", "MAX_MESSAGES_PER_HOUR")
- Object.const_set("MAX_MESSAGES_PER_HOUR", max_messages_per_hour)
+ Settings.max_messages_per_hour = max_messages_per_hour
end
end