From 9d3bca224f8743b210bc31c91e680ae85a02923e Mon Sep 17 00:00:00 2001 From: "jack.coggin" Date: Wed, 12 Jul 2023 10:02:42 +0100 Subject: [PATCH] rubocop --- .../training_emails_controller.rb | 8 ++--- app/forms/users/early_years_emails_form.rb | 32 +++++++++---------- .../completing_registration_spec.rb | 2 +- 3 files changed, 20 insertions(+), 22 deletions(-) diff --git a/app/controllers/registration/training_emails_controller.rb b/app/controllers/registration/training_emails_controller.rb index cbdee9ac4..edafe0061 100644 --- a/app/controllers/registration/training_emails_controller.rb +++ b/app/controllers/registration/training_emails_controller.rb @@ -9,12 +9,10 @@ def update if @user_form.save if ENV['EARLY_YEARS_EMAILS'] redirect_to edit_registration_early_years_emails_path + elsif current_user.registration_complete? + redirect_to my_modules_path, notice: t('.complete_update') else - if current_user.registration_complete? - redirect_to my_modules_path, notice: t('.complete_update') - else - complete_registration - end + complete_registration end else render :edit, status: :unprocessable_entity diff --git a/app/forms/users/early_years_emails_form.rb b/app/forms/users/early_years_emails_form.rb index 677c36e84..6aca7a6ee 100644 --- a/app/forms/users/early_years_emails_form.rb +++ b/app/forms/users/early_years_emails_form.rb @@ -1,19 +1,19 @@ module Users - class EarlyYearsEmailsForm < BaseForm - attr_accessor :early_years_emails - - validates :early_years_emails, presence: true - - def name - 'early_years_emails' - end - - def save - if valid? - user.update!( - early_years_emails: early_years_emails, - ) - end + class EarlyYearsEmailsForm < BaseForm + attr_accessor :early_years_emails + + validates :early_years_emails, presence: true + + def name + 'early_years_emails' + end + + def save + if valid? + user.update!( + early_years_emails: early_years_emails, + ) end end - end \ No newline at end of file + end +end diff --git a/spec/system/confirmed_user/completing_registration_spec.rb b/spec/system/confirmed_user/completing_registration_spec.rb index 066af05b2..d7f76beb2 100644 --- a/spec/system/confirmed_user/completing_registration_spec.rb +++ b/spec/system/confirmed_user/completing_registration_spec.rb @@ -81,7 +81,7 @@ choose 'Send me early years email updates' click_button 'Continue' - + end expect(page).to have_text('Thank you for creating an Early years child development training account. You can now start the first module.')