- def test_user_create_success
- I18n.available_locales.each do |locale|
- new_email = "#{locale}newtester@osm.org"
- display_name = "#{locale}_new_tester"
-
- assert_difference("User.count", 0) do
- assert_difference("ActionMailer::Base.deliveries.size", 0) do
- perform_enqueued_jobs do
- post "/user/new",
- :params => { :user => { :email => new_email, :email_confirmation => new_email, :display_name => display_name, :pass_crypt => "testtest", :pass_crypt_confirmation => "testtest" } }
- end
+ def test_user_create_submit_mismatched_passwords
+ email = "newtester@osm.org"
+ display_name = "new_tester"
+ assert_difference("User.count", 0) do
+ assert_difference("ActionMailer::Base.deliveries.size", 0) do
+ perform_enqueued_jobs do
+ post "/user/new",
+ :params => { :user => { :email => email,
+ :display_name => display_name,
+ :pass_crypt => "testtest",
+ :pass_crypt_confirmation => "blahblah",
+ :consider_pd => "1" } }
+ end
+ end
+ end
+ assert_response :success
+ assert_template "users/new"
+ assert_select "form > div > div > div > input.is-invalid#user_pass_crypt_confirmation"
+ end
+
+ def test_user_create_association_submit_duplicate_username
+ dup_display_name = create(:user).display_name
+ email = "new_tester"
+ assert_difference("User.count", 0) do
+ assert_no_difference("ActionMailer::Base.deliveries.size") do
+ perform_enqueued_jobs do
+ post "/user/new",
+ :params => { :user => { :email => email,
+ :display_name => dup_display_name,
+ :auth_provider => "google",
+ :auth_uid => "123454321",
+ :consider_pd => "1" } }