- post :save, :session => { :new_user => user }, :params => { :read_ct => 1, :read_tou => 1 }
+ post user_save_path, :params => { :read_ct => 1, :read_tou => 1 }
+ end
+ end
+ end
+
+ assert_response :success
+ assert_template "new"
+ assert_select "form > fieldset > div.standard-form-row > input.field_with_errors#user_email"
+ end
+
+ def test_save_duplicate_name
+ user = build(:user, :pending)
+
+ # Set up our user as being half-way through registration
+ assert_no_difference "User.count" do
+ assert_no_difference "ActionMailer::Base.deliveries.size" do
+ perform_enqueued_jobs do
+ post user_new_path, :params => { :user => user.attributes }
+ end
+ end
+ end
+
+ # Now create another user with that display name
+ create(:user, :display_name => user.display_name)
+
+ # Check that the second half of registration fails
+ assert_no_difference "User.count" do
+ assert_no_difference "ActionMailer::Base.deliveries.size" do
+ perform_enqueued_jobs do
+ post user_save_path, :params => { :read_ct => 1, :read_tou => 1 }