|
|
|
|
@ -322,37 +322,6 @@ RSpec.describe "User Features" do
|
|
|
|
|
expect(page).to have_title("Error") |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "validates telephone number is numeric" do |
|
|
|
|
visit("users/new") |
|
|
|
|
fill_in("user[name]", with: "New User") |
|
|
|
|
fill_in("user[email]", with: "newuser@example.com") |
|
|
|
|
fill_in("user[phone]", with: "randomstring") |
|
|
|
|
click_button("Continue") |
|
|
|
|
expect(page).to have_selector("#error-summary-title") |
|
|
|
|
expect(page).to have_selector("#user-phone-field-error") |
|
|
|
|
expect(page).to have_content(/Enter a telephone number in the correct format/) |
|
|
|
|
expect(page).to have_title("Error") |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "validates telephone number is longer than 11 digits" do |
|
|
|
|
visit("users/new") |
|
|
|
|
fill_in("user[name]", with: "New User") |
|
|
|
|
fill_in("user[email]", with: "newuser@example.com") |
|
|
|
|
fill_in("user[phone]", with: "123") |
|
|
|
|
click_button("Continue") |
|
|
|
|
expect(page).to have_selector("#error-summary-title") |
|
|
|
|
expect(page).to have_selector("#user-phone-field-error") |
|
|
|
|
expect(page).to have_content(/Enter a telephone number in the correct format/) |
|
|
|
|
expect(page).to have_title("Error") |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "allows telephone number in correct format" do |
|
|
|
|
visit("users/new") |
|
|
|
|
fill_in("user[phone]", with: "02345678910") |
|
|
|
|
click_button("Continue") |
|
|
|
|
expect(page).not_to have_content(/Enter a telephone number in the correct format/) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "sets name, email, role, is_dpo and is_key_contact fields" do |
|
|
|
|
visit("users/new") |
|
|
|
|
fill_in("user[name]", with: "New User") |
|
|
|
|
|