Browse Source

Rubocop

pull/155/head
baarkerlounger 3 years ago
parent
commit
6048bc7022
  1. 2
      app/helpers/application_helper.rb
  2. 4
      spec/features/form/validations_spec.rb
  3. 14
      spec/features/user_spec.rb

2
app/helpers/application_helper.rb

@ -1,7 +1,7 @@
module ApplicationHelper module ApplicationHelper
def browser_title(title) def browser_title(title)
if user_log_errors || case_log_errors || resource_errors if user_log_errors || case_log_errors || resource_errors
"Error: #{[title, t("service_name"), "GOV.UK"].select(&:present?).join(" - ")}" "Error: #{[title, t('service_name'), 'GOV.UK'].select(&:present?).join(' - ')}"
else else
[title, t("service_name"), "GOV.UK"].select(&:present?).join(" - ") [title, t("service_name"), "GOV.UK"].select(&:present?).join(" - ")
end end

4
spec/features/form/validations_spec.rb

@ -33,7 +33,7 @@ RSpec.describe "validations" do
expect(page).to have_selector("#error-summary-title") expect(page).to have_selector("#error-summary-title")
expect(page).to have_selector("#case-log-age1-error") expect(page).to have_selector("#case-log-age1-error")
expect(page).to have_selector("#case-log-age1-field-error") expect(page).to have_selector("#case-log-age1-field-error")
expect(page).to have_title('Error') expect(page).to have_title("Error")
end end
it " of greater than 120 it shows validation" do it " of greater than 120 it shows validation" do
@ -42,7 +42,7 @@ RSpec.describe "validations" do
expect(page).to have_selector("#error-summary-title") expect(page).to have_selector("#error-summary-title")
expect(page).to have_selector("#case-log-age1-error") expect(page).to have_selector("#case-log-age1-error")
expect(page).to have_selector("#case-log-age1-field-error") expect(page).to have_selector("#case-log-age1-field-error")
expect(page).to have_title('Error') expect(page).to have_title("Error")
end end
end end
end end

14
spec/features/user_spec.rb

@ -34,7 +34,7 @@ RSpec.describe "User Features" do
click_button("Send email") click_button("Send email")
expect(page).to have_selector("#error-summary-title") expect(page).to have_selector("#error-summary-title")
expect(page).to have_selector("#user-email-field-error") expect(page).to have_selector("#user-email-field-error")
expect(page).to have_title('Error') expect(page).to have_title("Error")
end end
it " is shown an error message if they submit an invalid email address" do it " is shown an error message if they submit an invalid email address" do
@ -43,7 +43,7 @@ RSpec.describe "User Features" do
click_button("Send email") click_button("Send email")
expect(page).to have_selector("#error-summary-title") expect(page).to have_selector("#error-summary-title")
expect(page).to have_selector("#user-email-field-error") expect(page).to have_selector("#user-email-field-error")
expect(page).to have_title('Error') expect(page).to have_title("Error")
end end
it " is redirected to check your email page after submitting an email on the reset password page" do it " is redirected to check your email page after submitting an email on the reset password page" do
@ -111,7 +111,7 @@ RSpec.describe "User Features" do
click_button("Sign in") click_button("Sign in")
expect(page).to have_selector("#error-summary-title") expect(page).to have_selector("#error-summary-title")
expect(page).to have_no_css(".govuk-notification-banner.govuk-notification-banner--success") expect(page).to have_no_css(".govuk-notification-banner.govuk-notification-banner--success")
expect(page).to have_title('Error') expect(page).to have_title("Error")
end end
it "show specific field error messages if a field was omitted" do it "show specific field error messages if a field was omitted" do
@ -120,7 +120,7 @@ RSpec.describe "User Features" do
expect(page).to have_selector("#error-summary-title") expect(page).to have_selector("#error-summary-title")
expect(page).to have_selector("#user-email-field-error") expect(page).to have_selector("#user-email-field-error")
expect(page).to have_selector("#user-password-field-error") expect(page).to have_selector("#user-password-field-error")
expect(page).to have_title('Error') expect(page).to have_title("Error")
end end
it "show specific field error messages if an invalid email address is entered" do it "show specific field error messages if an invalid email address is entered" do
@ -130,7 +130,7 @@ RSpec.describe "User Features" do
expect(page).to have_selector("#error-summary-title") expect(page).to have_selector("#error-summary-title")
expect(page).to have_selector("#user-email-field-error") expect(page).to have_selector("#user-email-field-error")
expect(page).to have_content(/Enter an email address in the correct format, like name@example.com/) expect(page).to have_content(/Enter an email address in the correct format, like name@example.com/)
expect(page).to have_title('Error') expect(page).to have_title("Error")
end end
end end
@ -185,7 +185,7 @@ RSpec.describe "User Features" do
expect(page).to have_selector("#error-summary-title") expect(page).to have_selector("#error-summary-title")
expect(page).to have_selector("#user-email-field-error") expect(page).to have_selector("#user-email-field-error")
expect(page).to have_content(/Enter an email address/) expect(page).to have_content(/Enter an email address/)
expect(page).to have_title('Error') expect(page).to have_title("Error")
end end
it "validates email" do it "validates email" do
@ -196,7 +196,7 @@ RSpec.describe "User Features" do
expect(page).to have_selector("#error-summary-title") expect(page).to have_selector("#error-summary-title")
expect(page).to have_selector("#user-email-field-error") expect(page).to have_selector("#user-email-field-error")
expect(page).to have_content(/Enter an email address in the correct format, like name@example.com/) expect(page).to have_content(/Enter an email address in the correct format, like name@example.com/)
expect(page).to have_title('Error') expect(page).to have_title("Error")
end end
end end
end end

Loading…
Cancel
Save