X-Git-Url: https://git.openstreetmap.org/rails.git/blobdiff_plain/cc8bb7c6a5730e9d7d0389e4efd4c896702f575f..e4c73424502c578773f1088237c604c709fcf959:/test/controllers/users_controller_test.rb diff --git a/test/controllers/users_controller_test.rb b/test/controllers/users_controller_test.rb index c21f82046..03657d288 100644 --- a/test/controllers/users_controller_test.rb +++ b/test/controllers/users_controller_test.rb @@ -958,9 +958,8 @@ class UsersControllerTest < ActionDispatch::IntegrationTest get user_account_path(user) assert_response :success assert_template :account - assert_select "div#errorExplanation", false assert_select ".notice", /^User information updated successfully/ - assert_select "form#accountForm > fieldset > div.standard-form-row > div#user_description_container > div#user_description_content > textarea#user_description", user.description + assert_select "form#accountForm > div.form-group > div#user_description_container > div#user_description_content > textarea#user_description", user.description # Changing to a invalid editor should fail user.preferred_editor = "unknown" @@ -968,8 +967,7 @@ class UsersControllerTest < ActionDispatch::IntegrationTest assert_response :success assert_template :account assert_select ".notice", false - assert_select "div#errorExplanation" - assert_select "form#accountForm > fieldset > div.standard-form-row > select#user_preferred_editor > option[selected]", false + assert_select "form#accountForm > div.form-group > select#user_preferred_editor > option[selected]", false # Changing to a valid editor should work user.preferred_editor = "id" @@ -979,9 +977,8 @@ class UsersControllerTest < ActionDispatch::IntegrationTest get user_account_path(user) assert_response :success assert_template :account - assert_select "div#errorExplanation", false assert_select ".notice", /^User information updated successfully/ - assert_select "form#accountForm > fieldset > div.standard-form-row > select#user_preferred_editor > option[selected][value=?]", "id" + assert_select "form#accountForm > div.form-group > select#user_preferred_editor > option[selected][value=?]", "id" # Changing to the default editor should work user.preferred_editor = "default" @@ -991,9 +988,8 @@ class UsersControllerTest < ActionDispatch::IntegrationTest get user_account_path(user) assert_response :success assert_template :account - assert_select "div#errorExplanation", false assert_select ".notice", /^User information updated successfully/ - assert_select "form#accountForm > fieldset > div.standard-form-row > select#user_preferred_editor > option[selected]", false + assert_select "form#accountForm > div.form-group > select#user_preferred_editor > option[selected]", false # Changing to an uploaded image should work image = Rack::Test::UploadedFile.new("test/gpx/fixtures/a.gif", "image/gif") @@ -1003,9 +999,8 @@ class UsersControllerTest < ActionDispatch::IntegrationTest get user_account_path(user) assert_response :success assert_template :account - assert_select "div#errorExplanation", false assert_select ".notice", /^User information updated successfully/ - assert_select "form#accountForm > fieldset > div.standard-form-row.accountImage input[name=avatar_action][checked][value=?]", "keep" + assert_select "form#accountForm > fieldset.form-group > div.form-row > div.col-sm-10 > div.form-check > input[name=avatar_action][checked][value=?]", "keep" # Changing to a gravatar image should work post user_account_path(user), :params => { :avatar_action => "gravatar", :user => user.attributes } @@ -1014,9 +1009,8 @@ class UsersControllerTest < ActionDispatch::IntegrationTest get user_account_path(user) assert_response :success assert_template :account - assert_select "div#errorExplanation", false assert_select ".notice", /^User information updated successfully/ - assert_select "form#accountForm > fieldset > div.standard-form-row.accountImage input[name=avatar_action][checked][value=?]", "gravatar" + assert_select "form#accountForm > fieldset.form-group > div.form-row > div.col-sm-10 > div.form-group > div.form-check > input[name=avatar_action][checked][value=?]", "gravatar" # Removing the image should work post user_account_path(user), :params => { :avatar_action => "delete", :user => user.attributes } @@ -1025,9 +1019,9 @@ class UsersControllerTest < ActionDispatch::IntegrationTest get user_account_path(user) assert_response :success assert_template :account - assert_select "div#errorExplanation", false assert_select ".notice", /^User information updated successfully/ - assert_select "form#accountForm > fieldset > div.standard-form-row.accountImage input[name=avatar_action][checked]", false + assert_select "form#accountForm > fieldset.form-group > div.form-row > div.col-sm-10 > div.form-check > input[name=avatar_action][checked]", false + assert_select "form#accountForm > fieldset.form-group > div.form-row > div.col-sm-10 > div.form-group > div.form-check > input[name=avatar_action][checked]", false # Adding external authentication should redirect to the auth provider post user_account_path(user), :params => { :user => user.attributes.merge(:auth_provider => "openid", :auth_uid => "gmail.com") } @@ -1040,8 +1034,7 @@ class UsersControllerTest < ActionDispatch::IntegrationTest assert_response :success assert_template :account assert_select ".notice", false - assert_select "div#errorExplanation" - assert_select "form#accountForm > fieldset > div.standard-form-row > input.field_with_errors#user_display_name" + assert_select "form#accountForm > div.form-group > input.is-invalid#user_display_name" # Changing name to one that exists should fail, regardless of case new_attributes = user.attributes.dup.merge(:display_name => create(:user).display_name.upcase) @@ -1049,8 +1042,7 @@ class UsersControllerTest < ActionDispatch::IntegrationTest assert_response :success assert_template :account assert_select ".notice", false - assert_select "div#errorExplanation" - assert_select "form#accountForm > fieldset > div.standard-form-row > input.field_with_errors#user_display_name" + assert_select "form#accountForm > div.form-group > input.is-invalid#user_display_name" # Changing name to one that doesn't exist should work new_attributes = user.attributes.dup.merge(:display_name => "new tester") @@ -1060,9 +1052,8 @@ class UsersControllerTest < ActionDispatch::IntegrationTest get user_account_path(:display_name => "new tester") assert_response :success assert_template :account - assert_select "div#errorExplanation", false assert_select ".notice", /^User information updated successfully/ - assert_select "form#accountForm > fieldset > div.standard-form-row > input#user_display_name[value=?]", "new tester" + assert_select "form#accountForm > div.form-group > input#user_display_name[value=?]", "new tester" # Record the change of name user.display_name = "new tester" @@ -1077,8 +1068,7 @@ class UsersControllerTest < ActionDispatch::IntegrationTest assert_response :success assert_template :account assert_select ".notice", false - assert_select "div#errorExplanation" - assert_select "form#accountForm > fieldset > div.standard-form-row > input.field_with_errors#user_new_email" + assert_select "form#accountForm > div.form-group > input.is-invalid#user_new_email" # Changing email to one that exists should fail, regardless of case user.new_email = create(:user).email.upcase @@ -1090,8 +1080,7 @@ class UsersControllerTest < ActionDispatch::IntegrationTest assert_response :success assert_template :account assert_select ".notice", false - assert_select "div#errorExplanation" - assert_select "form#accountForm > fieldset > div.standard-form-row > input.field_with_errors#user_new_email" + assert_select "form#accountForm > div.form-group > input.is-invalid#user_new_email" # Changing email to one that doesn't exist should work user.new_email = "new_tester@example.com" @@ -1105,9 +1094,8 @@ class UsersControllerTest < ActionDispatch::IntegrationTest get user_account_path(user) assert_response :success assert_template :account - assert_select "div#errorExplanation", false assert_select ".notice", /^User information updated successfully/ - assert_select "form#accountForm > fieldset > div.standard-form-row > input#user_new_email[value=?]", user.new_email + assert_select "form#accountForm > div.form-group > input#user_new_email[value=?]", user.new_email email = ActionMailer::Base.deliveries.first assert_equal 1, email.to.count assert_equal user.new_email, email.to.first