+ ##
+ # test the new action message limit
+ def test_new_limit
+ # Login as a normal user
+ session[:user] = users(:normal_user).id
+
+ # Check that sending a message fails when the message limit is hit
+ assert_no_difference "ActionMailer::Base.deliveries.size" do
+ assert_no_difference "Message.count" do
+ with_message_limit(0) do
+ post :new,
+ :display_name => users(:public_user).display_name,
+ :message => { :title => "Test Message", :body => "Test message body" }
+ assert_response :success
+ assert_template "new"
+ assert_select "p.error", /wait a while/
+ end
+ end
+ end
+ end
+