]> git.openstreetmap.org Git - rails.git/commitdiff
Test that mismatched passwords are rejected
authorTom Hughes <tom@compton.nu>
Fri, 12 Jan 2024 17:51:47 +0000 (17:51 +0000)
committerTom Hughes <tom@compton.nu>
Fri, 12 Jan 2024 17:55:16 +0000 (17:55 +0000)
test/integration/user_creation_test.rb

index e2d89f55554017ed66f9ae5ecefb3982db281a21..253f298a58f36493bb9e5bbca18c34586f75de30 100644 (file)
@@ -65,6 +65,26 @@ class UserCreationTest < ActionDispatch::IntegrationTest
     assert_select "form > div > input.is-invalid#user_display_name"
   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,
+                                       :email_confirmation => email,
+                                       :display_name => display_name,
+                                       :pass_crypt => "testtest",
+                                       :pass_crypt_confirmation => "blahblah" } }
+        end
+      end
+    end
+    assert_response :success
+    assert_template "users/new"
+    assert_select "form > div > input.is-invalid#user_pass_crypt_confirmation"
+  end
+
   def test_user_create_success
     new_email = "newtester@osm.org"
     display_name = "new_tester"