+ end
+
+ ##
+ # test fetching new message page with body and title
+ def test_new_get_with_params
+ # Login as a normal user
+ user = create(:user)
+ recipient_user = create(:user)
+ session[:user] = user.id
+
+ # Check that we can't send a message from a GET request
+ assert_difference "ActionMailer::Base.deliveries.size", 0 do
+ assert_difference "Message.count", 0 do
+ get :new,
+ :params => { :display_name => recipient_user.display_name,
+ :message => { :title => "Test Message", :body => "Test message body" } }
+ end
+ end
+ assert_response :success
+ assert_template "new"
+ assert_select "title", "OpenStreetMap | Send message"
+ assert_select "form[action='#{new_message_path(:display_name => recipient_user.display_name)}']", :count => 1 do
+ assert_select "input#message_title", :count => 1 do
+ assert_select "[value='Test Message']"
+ end
+ assert_select "textarea#message_body", :text => "Test message body", :count => 1
+ assert_select "input[type='submit'][value='Send']", :count => 1
+ end
+ end
+
+ ##
+ # test posting new message page with no body
+ def test_new_post_no_body
+ # Login as a normal user
+ user = create(:user)
+ recipient_user = create(:user)
+ session[:user] = user.id