Skip to content

Commit

Permalink
Cover missing and not matching passwords scenarios in Admin update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
danguita committed Feb 7, 2017
1 parent 69befa4 commit e71cdcf
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 0 deletions.
57 changes: 57 additions & 0 deletions test/integration/gobierto_admin/admin_update_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -111,5 +111,62 @@ def test_god_admin_update
end
end
end

def test_admin_update_with_not_matching_passwords
with_signed_in_admin(manager_admin) do
visit edit_admin_admin_path(regular_admin)

within "form.edit_admin" do
fill_in "admin_name", with: "Admin Name"
fill_in "admin_email", with: "[email protected]"
fill_in "admin_password", with: "wadus"
fill_in "admin_password_confirmation", with: "foo"

within ".site-module-check-boxes" do
check "Gobierto Development"
end

within ".site-check-boxes" do
check "madrid.gobierto.dev"
end

within ".admin-authorization-level-radio-buttons" do
choose "Regular"
end

click_button "Update"
end

assert has_alert?("Password confirmation doesn't match Password")
end
end

def test_admin_update_with_no_password_confirmation
with_signed_in_admin(manager_admin) do
visit edit_admin_admin_path(regular_admin)

within "form.edit_admin" do
fill_in "admin_name", with: "Admin Name"
fill_in "admin_email", with: "[email protected]"
fill_in "admin_password", with: "wadus"

within ".site-module-check-boxes" do
check "Gobierto Development"
end

within ".site-check-boxes" do
check "madrid.gobierto.dev"
end

within ".admin-authorization-level-radio-buttons" do
choose "Regular"
end

click_button "Update"
end

assert has_alert?("Password confirmation doesn't match Password")
end
end
end
end
6 changes: 6 additions & 0 deletions test/support/integration/matcher_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,11 @@ def has_message?(text)
has_content?(text)
end
end

def has_alert?(text)
within ".alert" do
has_content?(text)
end
end
end
end

0 comments on commit e71cdcf

Please sign in to comment.