- def test_save_duplicate_email
- 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 email
- create(:user, :email => user.email)
-
- # 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 }
- end
- end
- end
-
- assert_response :success
- assert_template "new"
- assert_select "form > div > input.is-invalid#user_email"
- end
-
- def test_save_duplicate_email_uppercase