diff --git a/.rubocop.yml b/.rubocop.yml index 40028b70d..1db06f6f3 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,25 +1,21 @@ -# .rubocop.yml +require: + rubocop-rspec + +# Omakase Ruby styling for Rails inherit_gem: - rubocop-govuk: - - config/default.yml - - config/rails.yml - - config/rspec.yml + rubocop-rails-omakase: rubocop.yml inherit_mode: merge: - Exclude -# ************************************************************** -# TRY NOT TO ADD OVERRIDES IN THIS FILE -# -# This repo is configured to follow the RuboCop GOV.UK styleguide. -# Any rules you override here will cause this repo to diverge from -# the way we write code in all other GOV.UK repos. -# -# See https://github.com/alphagov/rubocop-govuk/blob/main/CONTRIBUTING.md -# ************************************************************** - RSpec/SpecFilePathFormat: CustomTransform: OmniAuth: omniauth +Style/TrailingCommaInArrayLiteral: + EnforcedStyleForMultiline: comma +Style/TrailingCommaInHashLiteral: + EnforcedStyleForMultiline: comma +Style/TrailingCommaInArguments: + EnforcedStyleForMultiline: comma diff --git a/Gemfile b/Gemfile index 86c55ae7e..60daf7281 100644 --- a/Gemfile +++ b/Gemfile @@ -91,7 +91,8 @@ group :development, :test do gem "i18n-tasks", "~> 1.0.14" gem "rails-controller-testing" gem "rspec-rails", ">= 3.9.0" - gem "rubocop-govuk", require: false + gem "rubocop-rails-omakase", require: false + gem "rubocop-rspec", require: false # For security auditing gem vulnerabilities. RUN IN CI gem "bundler-audit", "~> 0.9.2" diff --git a/Gemfile.lock b/Gemfile.lock index 745c0f5cb..4569ee32c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -240,7 +240,7 @@ GEM json (2.9.1) jwt (2.8.2) base64 - language_server-protocol (3.17.0.3) + language_server-protocol (3.17.0.4) logger (1.6.5) lograge (0.14.0) actionpack (>= 4) @@ -418,35 +418,35 @@ GEM rspec-mocks (~> 3.13) rspec-support (~> 3.13) rspec-support (3.13.2) - rubocop (1.70.0) + rubocop (1.71.2) json (~> 2.3) language_server-protocol (>= 3.17.0) parallel (~> 1.10) parser (>= 3.3.0.2) rainbow (>= 2.2.2, < 4.0) regexp_parser (>= 2.9.3, < 3.0) - rubocop-ast (>= 1.36.2, < 2.0) + rubocop-ast (>= 1.38.0, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 2.4.0, < 4.0) - rubocop-ast (1.37.0) + rubocop-ast (1.38.0) parser (>= 3.3.1.0) - rubocop-capybara (2.21.0) - rubocop (~> 1.41) - rubocop-govuk (5.0.8) - rubocop (= 1.70.0) - rubocop-ast (= 1.37.0) - rubocop-capybara (= 2.21.0) - rubocop-rails (= 2.28.0) - rubocop-rake (= 0.6.0) - rubocop-rspec (= 3.3.0) - rubocop-rails (2.28.0) + rubocop-minitest (0.36.0) + rubocop (>= 1.61, < 2.0) + rubocop-ast (>= 1.31.1, < 2.0) + rubocop-performance (1.23.1) + rubocop (>= 1.48.1, < 2.0) + rubocop-ast (>= 1.31.1, < 2.0) + rubocop-rails (2.29.1) activesupport (>= 4.2.0) rack (>= 1.1) rubocop (>= 1.52.0, < 2.0) rubocop-ast (>= 1.31.1, < 2.0) - rubocop-rake (0.6.0) - rubocop (~> 1.0) - rubocop-rspec (3.3.0) + rubocop-rails-omakase (1.0.0) + rubocop + rubocop-minitest + rubocop-performance + rubocop-rails + rubocop-rspec (3.4.0) rubocop (~> 1.61) ruby-progressbar (1.13.0) rubyzip (2.4.1) @@ -565,7 +565,8 @@ DEPENDENCIES rails (= 8.0.1) rails-controller-testing rspec-rails (>= 3.9.0) - rubocop-govuk + rubocop-rails-omakase + rubocop-rspec selenium-webdriver sentry-rails sentry-ruby diff --git a/app/components/act_as_user_banner_component/view.rb b/app/components/act_as_user_banner_component/view.rb index c2e177652..48dbe3b79 100644 --- a/app/components/act_as_user_banner_component/view.rb +++ b/app/components/act_as_user_banner_component/view.rb @@ -25,11 +25,11 @@ def acting_user_details_content user_text = if @acting_as_user.organisation_admin? "an organisation admin" - elsif @acting_as_user.standard? + elsif @acting_as_user.standard? "a standard user" - else + else "a user with role: #{@acting_as_user.role}" - end + end "#{user_text} #{organisation_text}" end diff --git a/app/components/mark_complete_component/view.rb b/app/components/mark_complete_component/view.rb index 0359ec894..19a3e36ff 100644 --- a/app/components/mark_complete_component/view.rb +++ b/app/components/mark_complete_component/view.rb @@ -16,7 +16,7 @@ def initialize(form_model: false, generate_form: true, form_builder: nil, path: end def mark_complete_options - [OpenStruct.new(value: "true", name: t("mark_complete.true")), OpenStruct.new(value: "false", name: t("mark_complete.false"))] + [ OpenStruct.new(value: "true", name: t("mark_complete.true")), OpenStruct.new(value: "false", name: t("mark_complete.false")) ] end def before_render diff --git a/app/components/markdown_editor_component/view.rb b/app/components/markdown_editor_component/view.rb index 55f68ebf3..5e3a4df5e 100644 --- a/app/components/markdown_editor_component/view.rb +++ b/app/components/markdown_editor_component/view.rb @@ -31,7 +31,7 @@ def form_field_id end def allowed_formats - ["links", *(%w[headings] if allow_headings), "bulleted_lists", "numbered_lists"] + [ "links", *(%w[headings] if allow_headings), "bulleted_lists", "numbered_lists" ] end def preview_button_translation diff --git a/app/components/metrics_summary_component/view.rb b/app/components/metrics_summary_component/view.rb index d51294e88..507b810d4 100644 --- a/app/components/metrics_summary_component/view.rb +++ b/app/components/metrics_summary_component/view.rb @@ -6,7 +6,7 @@ class View < ViewComponent::Base def initialize(form_live_date, metrics_data) super - @start_date = [form_live_date, 7.days.ago.to_date].max + @start_date = [ form_live_date, 7.days.ago.to_date ].max @end_date = 1.day.ago.to_date @heading = heading_text.html_safe diff --git a/app/components/page_list_component/view.rb b/app/components/page_list_component/view.rb index ede5bd66c..ef40aa521 100644 --- a/app/components/page_list_component/view.rb +++ b/app/components/page_list_component/view.rb @@ -82,7 +82,7 @@ def process_routing_conditions .values .flat_map { |conditions| conditions.map.with_index(1) do |condition, index| - [condition.routing_page_id, [condition, index]] # inclde routing_page_id, so we can group by it + [ condition.routing_page_id, [ condition, index ] ] # inclde routing_page_id, so we can group by it end } .group_by(&:first) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 2b52b354c..2a7b5d30e 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -64,7 +64,7 @@ def set_logging_attributes def set_request_id # Pass the request id to the API to enable tracing if Rails.env.production? - [Api::V1::FormResource, Api::V1::PageResource].each do |active_resource_model| + [ Api::V1::FormResource, Api::V1::PageResource ].each do |active_resource_model| active_resource_model.headers["X-Request-ID"] = request.request_id end end @@ -75,7 +75,7 @@ def set_request_id # enough for our basic monitoring def user_ip(forwarded_for = "") first_ip_string = forwarded_for.split(",").first - Regexp.union([Resolv::IPv4::Regex, Resolv::IPv6::Regex]).match(first_ip_string) && first_ip_string + Regexp.union([ Resolv::IPv4::Regex, Resolv::IPv6::Regex ]).match(first_ip_string) && first_ip_string end def warden diff --git a/app/controllers/forms/declaration_controller.rb b/app/controllers/forms/declaration_controller.rb index b5b10e507..734bc845a 100644 --- a/app/controllers/forms/declaration_controller.rb +++ b/app/controllers/forms/declaration_controller.rb @@ -13,9 +13,9 @@ def create if @declaration_input.submit success_message = if @declaration_input.mark_complete == "true" t("banner.success.form.declaration_saved_and_completed") - else + else t("banner.success.form.declaration_saved") - end + end redirect_to form_path(@declaration_input.form), success: success_message else diff --git a/app/controllers/forms_controller.rb b/app/controllers/forms_controller.rb index a796dad32..b1b8dd26c 100644 --- a/app/controllers/forms_controller.rb +++ b/app/controllers/forms_controller.rb @@ -17,9 +17,9 @@ def mark_pages_section_completed if @mark_complete_input.submit success_message = if @mark_complete_input.mark_complete == "true" t("banner.success.form.pages_saved_and_section_completed") - else + else t("banner.success.form.pages_saved") - end + end redirect_to form_path(current_form.id), success: success_message else @mark_complete_input.mark_complete = "false" diff --git a/app/controllers/pages/selection/options_controller.rb b/app/controllers/pages/selection/options_controller.rb index 3f37013b5..b9a65f85d 100644 --- a/app/controllers/pages/selection/options_controller.rb +++ b/app/controllers/pages/selection/options_controller.rb @@ -75,6 +75,6 @@ def include_none_of_the_above_param_values def input_params params.require(:pages_selection_options_input) - .permit(:include_none_of_the_above, selection_options: [:name]).to_h.deep_symbolize_keys + .permit(:include_none_of_the_above, selection_options: [ :name ]).to_h.deep_symbolize_keys end end diff --git a/app/controllers/pages_controller.rb b/app/controllers/pages_controller.rb index 184af2365..36577094a 100644 --- a/app/controllers/pages_controller.rb +++ b/app/controllers/pages_controller.rb @@ -81,9 +81,9 @@ def move_page position = if move_params[:direction] == :up page_to_move.position - 1 - else + else page_to_move.position + 1 - end + end redirect_to form_pages_path, success: t("banner.success.form.page_moved", question_text: page_to_move.question_text, direction: move_params[:direction], position:) end @@ -105,9 +105,9 @@ def page def draft_question @draft_question ||= if params[:page_id].present? setup_draft_question_for_existing_page - else + else DraftQuestion.find_or_initialize_by(form_id: current_form.id, user_id: current_user.id) - end + end end def move_params diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index b645be246..2b952d598 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -2,7 +2,7 @@ module ApplicationHelper def page_title - [content_for(:title), "GOV.UK Forms"].compact.join(I18n.t("page_titles.separator")) + [ content_for(:title), "GOV.UK Forms" ].compact.join(I18n.t("page_titles.separator")) end def set_page_title(title) diff --git a/app/input_objects/forms/contact_details_input.rb b/app/input_objects/forms/contact_details_input.rb index 22164b6cc..6109ab112 100644 --- a/app/input_objects/forms/contact_details_input.rb +++ b/app/input_objects/forms/contact_details_input.rb @@ -41,9 +41,9 @@ def submit end def assign_form_values - self.contact_details_supplied |= [:supply_email] if form.support_email.present? - self.contact_details_supplied |= [:supply_phone] if form.support_phone.present? - self.contact_details_supplied |= [:supply_link] if form.support_url.present? + self.contact_details_supplied |= [ :supply_email ] if form.support_email.present? + self.contact_details_supplied |= [ :supply_phone ] if form.support_phone.present? + self.contact_details_supplied |= [ :supply_link ] if form.support_url.present? self.email = form.support_email self.phone = form.support_phone diff --git a/app/input_objects/forms/submission_email_input.rb b/app/input_objects/forms/submission_email_input.rb index 6facdd987..af556b0fb 100644 --- a/app/input_objects/forms/submission_email_input.rb +++ b/app/input_objects/forms/submission_email_input.rb @@ -20,9 +20,9 @@ def submit form_processed = if form_submission_email.nil? create_submission_email_record(confirmation_code) - else + else update_submission_email_record(confirmation_code, form_submission_email) - end + end if form_processed && temporary_submission_email.present? # send notify email? diff --git a/app/input_objects/group_member_input.rb b/app/input_objects/group_member_input.rb index 8b41ac68a..3000c6157 100644 --- a/app/input_objects/group_member_input.rb +++ b/app/input_objects/group_member_input.rb @@ -26,7 +26,7 @@ def submit end def role_options - Membership.roles.keys.map { |role| [I18n.t("membership.roles.#{role}"), role] } + Membership.roles.keys.map { |role| [ I18n.t("membership.roles.#{role}"), role ] } end def invited_user diff --git a/app/input_objects/pages/question_input.rb b/app/input_objects/pages/question_input.rb index 0e30309c2..dcd9c2f39 100644 --- a/app/input_objects/pages/question_input.rb +++ b/app/input_objects/pages/question_input.rb @@ -53,11 +53,11 @@ def update_page(page) end def default_options - [OpenStruct.new(id: "false"), OpenStruct.new(id: "true")] + [ OpenStruct.new(id: "false"), OpenStruct.new(id: "true") ] end def repeatable_options - [OpenStruct.new(id: "true"), OpenStruct.new(id: "false")] + [ OpenStruct.new(id: "true"), OpenStruct.new(id: "false") ] end def validate_number_of_selection_options diff --git a/app/input_objects/pages/selection/bulk_options_input.rb b/app/input_objects/pages/selection/bulk_options_input.rb index 7c40be67e..c34518167 100644 --- a/app/input_objects/pages/selection/bulk_options_input.rb +++ b/app/input_objects/pages/selection/bulk_options_input.rb @@ -30,7 +30,7 @@ def submit end def none_of_the_above_options - [OpenStruct.new(id: "true"), OpenStruct.new(id: "false")] + [ OpenStruct.new(id: "true"), OpenStruct.new(id: "false") ] end def only_one_option? diff --git a/app/input_objects/pages/selection/options_input.rb b/app/input_objects/pages/selection/options_input.rb index d24909fac..40a8cdc5b 100644 --- a/app/input_objects/pages/selection/options_input.rb +++ b/app/input_objects/pages/selection/options_input.rb @@ -1,7 +1,7 @@ class Pages::Selection::OptionsInput < BaseInput include LoggingHelper - DEFAULT_OPTIONS = { selection_options: [{ name: "" }, { name: "" }] }.freeze + DEFAULT_OPTIONS = { selection_options: [ { name: "" }, { name: "" } ] }.freeze INCLUDE_NONE_OF_THE_ABOVE_OPTIONS = %w[true false].freeze MAXIMUM_CHOOSE_ONLY_ONE_OPTION = 1000 MAXIMUM_CHOOSE_MORE_THAN_ONE_OPTION = 30 @@ -42,7 +42,7 @@ def selection_options_form_objects end def include_none_of_the_above_options - [OpenStruct.new(id: "true"), OpenStruct.new(id: "false")] + [ OpenStruct.new(id: "true"), OpenStruct.new(id: "false") ] end def maximum_options diff --git a/app/input_objects/pages/selection/type_input.rb b/app/input_objects/pages/selection/type_input.rb index c7ce946a8..0da2bd67f 100644 --- a/app/input_objects/pages/selection/type_input.rb +++ b/app/input_objects/pages/selection/type_input.rb @@ -17,7 +17,7 @@ def submit end def only_one_option_options - [OpenStruct.new(id: "true"), OpenStruct.new(id: "false")] + [ OpenStruct.new(id: "true"), OpenStruct.new(id: "false") ] end def need_to_reduce_options? diff --git a/app/input_objects/pages/type_of_answer_input.rb b/app/input_objects/pages/type_of_answer_input.rb index d6cf8d2cb..d7cfaf6ad 100644 --- a/app/input_objects/pages/type_of_answer_input.rb +++ b/app/input_objects/pages/type_of_answer_input.rb @@ -1,7 +1,7 @@ class Pages::TypeOfAnswerInput < BaseInput attr_accessor :answer_type, :draft_question, :answer_types, :current_form - SELECTION_DEFAULT_OPTIONS = { selection_options: [{ name: "" }, { name: "" }] }.freeze + SELECTION_DEFAULT_OPTIONS = { selection_options: [ { name: "" }, { name: "" } ] }.freeze validates :draft_question, presence: true validates :answer_type, presence: true, inclusion: { in: :answer_types } diff --git a/app/models/user.rb b/app/models/user.rb index cada29253..88fc08920 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -30,7 +30,7 @@ class UserAuthenticationException < StandardError; end validates :name, presence: true, if: :requires_name? validates :role, presence: true validates :organisation_id, presence: true, if: :requires_organisation? - validates :has_access, inclusion: [true, false] + validates :has_access, inclusion: [ true, false ] validates :role, exclusion: %w[organisation_admin], unless: :current_org_has_mou? validates :email, uniqueness: { case_sensitive: false } diff --git a/app/presenters/form_list_presenter.rb b/app/presenters/form_list_presenter.rb index ddf8580a4..8a47b0b20 100644 --- a/app/presenters/form_list_presenter.rb +++ b/app/presenters/form_list_presenter.rb @@ -43,10 +43,10 @@ def head end def rows - forms.sort_by { |form| [form.name.downcase, form.created_at] }.map do |form| - [{ text: form_name_link(form) }, + forms.sort_by { |form| [ form.name.downcase, form.created_at ] }.map do |form| + [ { text: form_name_link(form) }, { text: find_creator_name(form) }, - { text: form_status_tags(form), numeric: true }].compact + { text: form_status_tags(form), numeric: true } ].compact end end diff --git a/app/presenters/route_summary_card_data_presenter.rb b/app/presenters/route_summary_card_data_presenter.rb index 3f77d98ab..fee6d8b27 100644 --- a/app/presenters/route_summary_card_data_presenter.rb +++ b/app/presenters/route_summary_card_data_presenter.rb @@ -64,9 +64,9 @@ def secondary_skip_card edit_secondary_skip_link, delete_secondary_skip_link, ] - else + else [] - end + end { card: { diff --git a/app/services/default_group_service.rb b/app/services/default_group_service.rb index 988b6f2f7..fda25f9f8 100644 --- a/app/services/default_group_service.rb +++ b/app/services/default_group_service.rb @@ -5,7 +5,7 @@ class DefaultGroupService def create_user_default_trial_group!(user) return unless user.name.present? && user.organisation.present? - forms = FormRepository.where(creator_id: user.id).to_h { [_1.id, _1] } + forms = FormRepository.where(creator_id: user.id).to_h { [ _1.id, _1 ] } form_ids = forms.keys group_form_ids = GroupForm.where(form_id: form_ids).pluck(:form_id) not_group_form_ids = form_ids.to_set - group_form_ids diff --git a/app/services/form_task_list_service.rb b/app/services/form_task_list_service.rb index d28b908da..b6c3e564d 100644 --- a/app/services/form_task_list_service.rb +++ b/app/services/form_task_list_service.rb @@ -48,9 +48,9 @@ def create_form_section def create_form_section_tasks question_path = if FormRepository.pages(@form).any? form_pages_path(@form.id) - else + else start_new_question_path(@form.id) - end + end [ { task_name: I18n.t("forms.task_list_#{create_or_edit}.create_form_section.name"), path: change_form_name_path(@form.id), status: @task_statuses[:name_status] }, { task_name: I18n.t("forms.task_list_#{create_or_edit}.create_form_section.questions"), path: question_path, status: @task_statuses[:pages_status] }, @@ -85,8 +85,8 @@ def email_address_section def email_address_section_tasks hint_text = I18n.t("forms.task_list_#{create_or_edit}.email_address_section.hint_text_html", submission_email: @form.submission_email) if @form.submission_email.present? - [{ task_name: I18n.t("forms.task_list_#{create_or_edit}.email_address_section.email"), path: submission_email_input_path(@form.id), hint_text:, status: @task_statuses[:submission_email_status] }, - { task_name: I18n.t("forms.task_list_#{create_or_edit}.email_address_section.confirm_email"), path: submission_email_code_path(@form.id), status: @task_statuses[:confirm_submission_email_status], active: can_enter_submission_email_code }] + [ { task_name: I18n.t("forms.task_list_#{create_or_edit}.email_address_section.email"), path: submission_email_input_path(@form.id), hint_text:, status: @task_statuses[:submission_email_status] }, + { task_name: I18n.t("forms.task_list_#{create_or_edit}.email_address_section.confirm_email"), path: submission_email_code_path(@form.id), status: @task_statuses[:confirm_submission_email_status], active: can_enter_submission_email_code } ] end def receive_csv_subsection diff --git a/app/services/page_options_service.rb b/app/services/page_options_service.rb index eac521128..010e2220d 100644 --- a/app/services/page_options_service.rb +++ b/app/services/page_options_service.rb @@ -34,28 +34,28 @@ def all_options_for_answer_type private def page_heading_options - [{ + [ { key: { text: I18n.t("page_options_service.page_heading") }, value: { text: @page.page_heading }, - }] + } ] end def markdown_content - safe_join(['
'.html_safe, @page.guidance_markdown, "".html_safe]) + safe_join([ '
'.html_safe, @page.guidance_markdown, "".html_safe ]) end def guidance_markdown_options - [{ + [ { key: { text: I18n.t("page_options_service.guidance_markdown") }, value: { text: markdown_content }, - }] + } ] end def hint_options - [{ + [ { key: { text: I18n.t("page_options_service.hint_text") }, value: { text: @page.hint_text }, - }] + } ] end def generic_options @@ -91,11 +91,11 @@ def selection_list end def text_options - [{ key: { text: I18n.t("page_options_service.answer_type") }, value: { text: I18n.t("helpers.label.page.text_settings_options.names.#{@page.answer_settings.input_type}") } }] + [ { key: { text: I18n.t("page_options_service.answer_type") }, value: { text: I18n.t("helpers.label.page.text_settings_options.names.#{@page.answer_settings.input_type}") } } ] end def date_options - [{ key: { text: I18n.t("page_options_service.answer_type") }, value: { text: date_answer_type_text } }] + [ { key: { text: I18n.t("page_options_service.answer_type") }, value: { text: date_answer_type_text } } ] end def date_answer_type_text @@ -105,22 +105,22 @@ def date_answer_type_text end def address_options - [{ key: { text: I18n.t("page_options_service.answer_type") }, value: { text: I18n.t("helpers.label.page.address_settings_options.names.#{address_input_type_to_string}") } }] + [ { key: { text: I18n.t("page_options_service.answer_type") }, value: { text: I18n.t("helpers.label.page.address_settings_options.names.#{address_input_type_to_string}") } } ] end def name_options - [{ key: { text: I18n.t("page_options_service.answer_type") }, value: { text: name_answer_type } }] + [ { key: { text: I18n.t("page_options_service.answer_type") }, value: { text: name_answer_type } } ] end def name_answer_type title_needed = if @page.answer_settings.title_needed == "true" I18n.t("page_options_service.name_type.title_selected") - else + else I18n.t("page_options_service.name_type.title_not_selected") - end + end - settings = [I18n.t("helpers.label.page.answer_type_options.names.#{@page.answer_type}"), - I18n.t("helpers.label.page.name_settings_options.names.#{@page.answer_settings.input_type}")] + settings = [ I18n.t("helpers.label.page.answer_type_options.names.#{@page.answer_type}"), + I18n.t("helpers.label.page.name_settings_options.names.#{@page.answer_settings.input_type}") ] settings << title_needed formatted_list = html_list_item(settings) @@ -140,7 +140,7 @@ def address_input_type_to_string end def route_options - [{ key: { text: I18n.t("page_conditions.route") }, value: { text: route_value.html_safe } }] + [ { key: { text: I18n.t("page_conditions.route") }, value: { text: route_value.html_safe } } ] end def route_value @@ -166,7 +166,7 @@ def print_route(condition) end def html_ordered_list(list_items) - content_tag(:ol, html_list_item(list_items), class: ["govuk-list", "govuk-list--number"]) + content_tag(:ol, html_list_item(list_items), class: [ "govuk-list", "govuk-list--number" ]) end def html_list_item(item) diff --git a/app/services/page_summary_data/guidance_service.rb b/app/services/page_summary_data/guidance_service.rb index 30df19ce3..649350d56 100644 --- a/app/services/page_summary_data/guidance_service.rb +++ b/app/services/page_summary_data/guidance_service.rb @@ -25,22 +25,22 @@ def build_data private def options - [{ + [ { key: { text: "Page heading" }, value: { text: draft_question.page_heading }, - actions: [{ href: change_url, visually_hidden_text: "page heading" }], + actions: [ { href: change_url, visually_hidden_text: "page heading" } ], }, { key: { text: "Guidance text" }, value: { text: markdown_content, }, - actions: [{ href: change_url, visually_hidden_text: "guidance text" }], - }] + actions: [ { href: change_url, visually_hidden_text: "guidance text" } ], + } ] end def markdown_content - safe_join(['
'.html_safe, draft_question.guidance_markdown, "".html_safe]) + safe_join([ '
'.html_safe, draft_question.guidance_markdown, "".html_safe ]) end def change_url diff --git a/app/services/reports/users_report_service.rb b/app/services/reports/users_report_service.rb index 41c22506d..c2f68c4ef 100644 --- a/app/services/reports/users_report_service.rb +++ b/app/services/reports/users_report_service.rb @@ -19,8 +19,8 @@ def rows def as_data_rows(raw_data) raw_data.map do |org_name, count| - [{ text: org_name || I18n.t("users.index.organisation_blank") }, - { text: count, numeric: true }] + [ { text: org_name || I18n.t("users.index.organisation_blank") }, + { text: count, numeric: true } ] end end diff --git a/config/application.rb b/config/application.rb index c9cbd6603..fe4d02cc7 100644 --- a/config/application.rb +++ b/config/application.rb @@ -35,7 +35,7 @@ class Application < Rails::Application # Make it easier to share partials between controllers config.action_view.prefix_partial_path_with_controller_namespace = false - config.view_component.preview_paths = [Rails.root.join("spec/components")] + config.view_component.preview_paths = [ Rails.root.join("spec/components") ] config.view_component.preview_route = "/preview" config.view_component.preview_controller = "ComponentPreviewController" # Replace with value which will be true in local dev diff --git a/config/initializers/authentication.rb b/config/initializers/authentication.rb index 9f1e5fbe2..943137034 100644 --- a/config/initializers/authentication.rb +++ b/config/initializers/authentication.rb @@ -23,7 +23,7 @@ if Rails.env.development? || Rails.env.test? || (Settings.forms_env == "review") Rails.application.config.app_middleware.use( OmniAuth::Strategies::Developer, - fields: [:email], + fields: [ :email ], ) end diff --git a/config/initializers/sentry.rb b/config/initializers/sentry.rb index cd426ee7c..c2fc6416c 100644 --- a/config/initializers/sentry.rb +++ b/config/initializers/sentry.rb @@ -11,7 +11,7 @@ config.environment = Settings.sentry.environment filter = ActiveSupport::ParameterFilter.new( - [EmailParameterFilterProc.new(mask: Settings.sentry.filter_mask)], + [ EmailParameterFilterProc.new(mask: Settings.sentry.filter_mask) ], mask: Settings.sentry.filter_mask, ) config.before_send = lambda do |event, _hint| diff --git a/config/initializers/warden/strategies/basic_auth.rb b/config/initializers/warden/strategies/basic_auth.rb index c5821064a..7c84c849c 100644 --- a/config/initializers/warden/strategies/basic_auth.rb +++ b/config/initializers/warden/strategies/basic_auth.rb @@ -31,7 +31,7 @@ def authenticate! ), ) else - custom! [@status, headers, [@message]] + custom! [ @status, headers, [ @message ] ] end end end diff --git a/db/schema.rb b/db/schema.rb index 074dd06de..75cfe84f5 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -163,10 +163,6 @@ t.index ["form_id"], name: "index_pages_on_form_id" end - create_table "schema_info", id: false, force: :cascade do |t| - t.integer "version", default: 0, null: false - end - create_table "users", force: :cascade do |t| t.string "name" t.string "email" diff --git a/lib/tasks/deploy.rake b/lib/tasks/deploy.rake index cdac3e13d..2b4383e81 100644 --- a/lib/tasks/deploy.rake +++ b/lib/tasks/deploy.rake @@ -76,6 +76,6 @@ def push_commit_to_dev(git_hash) end def sh_aws(*cmd) - all_args = ["gds", "aws", "forms-deploy-support", "--", *cmd] + all_args = [ "gds", "aws", "forms-deploy-support", "--", *cmd ] system({ **ENV, "AWS_VAULT" => nil }, *all_args, exception: true) end diff --git a/lib/tasks/pause_pipelines.rake b/lib/tasks/pause_pipelines.rake index 25fb19d73..c6312a5ed 100644 --- a/lib/tasks/pause_pipelines.rake +++ b/lib/tasks/pause_pipelines.rake @@ -71,7 +71,7 @@ namespace :pipeline do paused_transitions = pipeline_definition.stage_states.filter_map do |stage| unless stage.inbound_transition_state.enabled - [stage.stage_name, "inbound", stage.inbound_transition_state.disabled_reason] + [ stage.stage_name, "inbound", stage.inbound_transition_state.disabled_reason ] end end diff --git a/spec/components/error_summary_component/error_summary_component_preview.rb b/spec/components/error_summary_component/error_summary_component_preview.rb index 50d6c0fb0..beb494852 100644 --- a/spec/components/error_summary_component/error_summary_component_preview.rb +++ b/spec/components/error_summary_component/error_summary_component_preview.rb @@ -4,7 +4,7 @@ def default end def with_errors - errors = [OpenStruct.new(message: "You have an error", link: "https://example.gov.uk/error1"), OpenStruct.new(message: "You have another error", link: "https://example.gov.uk/error2")] + errors = [ OpenStruct.new(message: "You have an error", link: "https://example.gov.uk/error1"), OpenStruct.new(message: "You have another error", link: "https://example.gov.uk/error2") ] render(ErrorSummaryComponent::View.new(errors:)) end end diff --git a/spec/components/error_summary_component/view_spec.rb b/spec/components/error_summary_component/view_spec.rb index 86193be06..e3fe34880 100644 --- a/spec/components/error_summary_component/view_spec.rb +++ b/spec/components/error_summary_component/view_spec.rb @@ -12,7 +12,7 @@ end context "when given an array of errors" do - let(:errors) { [OpenStruct.new(message: "You have an error", link: "https://example.gov.uk/error1"), OpenStruct.new(message: "You have another error", link: "https://example.gov.uk/error2")] } + let(:errors) { [ OpenStruct.new(message: "You have an error", link: "https://example.gov.uk/error1"), OpenStruct.new(message: "You have another error", link: "https://example.gov.uk/error2") ] } before do render_inline(described_class.new(errors:)) diff --git a/spec/components/group_list_component/group_list_component_preview.rb b/spec/components/group_list_component/group_list_component_preview.rb index fa3ba5c5f..4fe6edc56 100644 --- a/spec/components/group_list_component/group_list_component_preview.rb +++ b/spec/components/group_list_component/group_list_component_preview.rb @@ -6,6 +6,6 @@ def default end def with_groups - render(GroupListComponent::View.new(groups: [build(:group), build(:group)], title: "Your active groups", empty_message: "There are no active groups to display")) + render(GroupListComponent::View.new(groups: [ build(:group), build(:group) ], title: "Your active groups", empty_message: "There are no active groups to display")) end end diff --git a/spec/components/page_list_component/error_summary/error_summary_component_preview.rb b/spec/components/page_list_component/error_summary/error_summary_component_preview.rb index 477a9766e..affaa459a 100644 --- a/spec/components/page_list_component/error_summary/error_summary_component_preview.rb +++ b/spec/components/page_list_component/error_summary/error_summary_component_preview.rb @@ -6,21 +6,21 @@ def default end def error_component_without_errors - routing_conditions = [(build :condition, id: 1, routing_page_id: 1, check_page_id: 1, answer_value: "Wales", goto_page_id: 3), - (build :condition, id: 2, routing_page_id: 1, check_page_id: 1, answer_value: "England", goto_page_id: 2)] - pages = [(build :page, id: 1, position: 1, question_text: "Enter your name", routing_conditions:), + routing_conditions = [ (build :condition, id: 1, routing_page_id: 1, check_page_id: 1, answer_value: "Wales", goto_page_id: 3), + (build :condition, id: 2, routing_page_id: 1, check_page_id: 1, answer_value: "England", goto_page_id: 2) ] + pages = [ (build :page, id: 1, position: 1, question_text: "Enter your name", routing_conditions:), (build :page, id: 2, position: 2, question_text: "What is your pet's phone number?", routing_conditions: []), - (build :page, id: 3, position: 3, question_text: "How many pets do you own?", routing_conditions: [])] + (build :page, id: 3, position: 3, question_text: "How many pets do you own?", routing_conditions: []) ] render(PageListComponent::ErrorSummary::View.new(pages:)) end def error_component_with_errors - routing_conditions_page_1 = [(build :condition, :with_answer_value_missing, id: 1, routing_page_id: 1, check_page_id: 1, goto_page_id: 3)] - routing_conditions_page_2 = [(build :condition, :with_goto_page_missing, id: 2, routing_page_id: 2, check_page_id: 2, answer_value: "Wales")] + routing_conditions_page_1 = [ (build :condition, :with_answer_value_missing, id: 1, routing_page_id: 1, check_page_id: 1, goto_page_id: 3) ] + routing_conditions_page_2 = [ (build :condition, :with_goto_page_missing, id: 2, routing_page_id: 2, check_page_id: 2, answer_value: "Wales") ] - pages = [(build :page, id: 1, position: 1, question_text: "Enter your name", routing_conditions: routing_conditions_page_1), + pages = [ (build :page, id: 1, position: 1, question_text: "Enter your name", routing_conditions: routing_conditions_page_1), (build :page, id: 2, position: 2, question_text: "What is your pet's phone number?", routing_conditions: routing_conditions_page_2), - (build :page, id: 3, position: 3, question_text: "How many pets do you own?", routing_conditions: [])] + (build :page, id: 3, position: 3, question_text: "How many pets do you own?", routing_conditions: []) ] render(PageListComponent::ErrorSummary::View.new(pages:)) end diff --git a/spec/components/page_list_component/error_summary/view_spec.rb b/spec/components/page_list_component/error_summary/view_spec.rb index 4090b1ef2..0d4bd85bd 100644 --- a/spec/components/page_list_component/error_summary/view_spec.rb +++ b/spec/components/page_list_component/error_summary/view_spec.rb @@ -18,13 +18,13 @@ context "when there are no errors" do let(:routing_conditions) do - [(build :condition, id: 1, routing_page_id: 1, check_page_id: 1, answer_value: "Wales", goto_page_id: 3), - (build :condition, id: 2, routing_page_id: 1, check_page_id: 1, answer_value: "England", goto_page_id: 2)] + [ (build :condition, id: 1, routing_page_id: 1, check_page_id: 1, answer_value: "Wales", goto_page_id: 3), + (build :condition, id: 2, routing_page_id: 1, check_page_id: 1, answer_value: "England", goto_page_id: 2) ] end let(:pages) do - [(build :page, id: 1, position: 1, question_text: "Enter your name", routing_conditions:), + [ (build :page, id: 1, position: 1, question_text: "Enter your name", routing_conditions:), (build :page, id: 2, position: 2, question_text: "What is your pet's phone number?", routing_conditions: []), - (build :page, id: 3, position: 3, question_text: "How many pets do you own?", routing_conditions: [])] + (build :page, id: 3, position: 3, question_text: "How many pets do you own?", routing_conditions: []) ] end it "is blank" do @@ -34,13 +34,13 @@ context "when the form has a route with an error" do let(:routing_conditions) do - [(build :condition, :with_answer_value_missing, id: 1, routing_page_id: 1, check_page_id: 1, goto_page_id: 3), - (build :condition, id: 2, routing_page_id: 1, check_page_id: 1, answer_value: "England", goto_page_id: 2)] + [ (build :condition, :with_answer_value_missing, id: 1, routing_page_id: 1, check_page_id: 1, goto_page_id: 3), + (build :condition, id: 2, routing_page_id: 1, check_page_id: 1, answer_value: "England", goto_page_id: 2) ] end let(:pages) do - [(build :page, id: 1, position: 1, question_text: "Enter your name", routing_conditions:), + [ (build :page, id: 1, position: 1, question_text: "Enter your name", routing_conditions:), (build :page, id: 2, position: 2, question_text: "What is your pet's phone number?", routing_conditions: []), - (build :page, id: 3, position: 3, question_text: "How many pets do you own?", routing_conditions: [])] + (build :page, id: 3, position: 3, question_text: "How many pets do you own?", routing_conditions: []) ] end it "renders the error_summary" do @@ -55,15 +55,15 @@ context "when the form has multiple routes with errors" do let(:routing_conditions_page_with_answer_value_missing) do - [(build :condition, :with_answer_value_missing, id: 1, routing_page_id: 1, check_page_id: 1, goto_page_id: 3)] + [ (build :condition, :with_answer_value_missing, id: 1, routing_page_id: 1, check_page_id: 1, goto_page_id: 3) ] end let(:routing_conditions_page_with_goto_page_missing) do - [(build :condition, :with_goto_page_missing, id: 2, routing_page_id: 2, check_page_id: 2, answer_value: "Wales")] + [ (build :condition, :with_goto_page_missing, id: 2, routing_page_id: 2, check_page_id: 2, answer_value: "Wales") ] end let(:pages) do - [(build :page, id: 1, position: 1, question_text: "Enter your name", routing_conditions: routing_conditions_page_with_answer_value_missing), + [ (build :page, id: 1, position: 1, question_text: "Enter your name", routing_conditions: routing_conditions_page_with_answer_value_missing), (build :page, id: 2, position: 2, question_text: "What is your pet's phone number?", routing_conditions: routing_conditions_page_with_goto_page_missing), - (build :page, id: 3, position: 3, question_text: "How many pets do you own?", routing_conditions: [])] + (build :page, id: 3, position: 3, question_text: "How many pets do you own?", routing_conditions: []) ] end it "renders the error_summary" do @@ -81,15 +81,15 @@ describe "class methods" do let(:routing_conditions_page_with_answer_value_missing) do - [(build :condition, :with_answer_value_missing, id: 1, routing_page_id: 1, check_page_id: 1, goto_page_id: 3)] + [ (build :condition, :with_answer_value_missing, id: 1, routing_page_id: 1, check_page_id: 1, goto_page_id: 3) ] end let(:routing_conditions_page_with_goto_page_missing) do - [(build :condition, :with_goto_page_missing, id: 2, routing_page_id: 2, check_page_id: 2, answer_value: "Wales")] + [ (build :condition, :with_goto_page_missing, id: 2, routing_page_id: 2, check_page_id: 2, answer_value: "Wales") ] end let(:pages) do - [(build :page, id: 1, position: 1, question_text: "Enter your name", routing_conditions: routing_conditions_page_with_answer_value_missing), + [ (build :page, id: 1, position: 1, question_text: "Enter your name", routing_conditions: routing_conditions_page_with_answer_value_missing), (build :page, id: 2, position: 2, question_text: "What is your pet's phone number?", routing_conditions: routing_conditions_page_with_goto_page_missing), - (build :page, id: 3, position: 3, question_text: "How many pets do you own?", routing_conditions: [])] + (build :page, id: 3, position: 3, question_text: "How many pets do you own?", routing_conditions: []) ] end describe "#error_id" do @@ -106,7 +106,7 @@ describe "#conditions_with_page_indexes" do it "returns all of the conditions for a form with their respective conditions and page positions" do - expect(error_summary_component.conditions_with_page_indexes).to eq [OpenStruct.new(condition: routing_conditions_page_with_answer_value_missing[0], page_index: 1), OpenStruct.new(condition: routing_conditions_page_with_goto_page_missing[0], page_index: 2)] + expect(error_summary_component.conditions_with_page_indexes).to eq [ OpenStruct.new(condition: routing_conditions_page_with_answer_value_missing[0], page_index: 1), OpenStruct.new(condition: routing_conditions_page_with_goto_page_missing[0], page_index: 2) ] end end diff --git a/spec/components/page_list_component/page_list_component_preview.rb b/spec/components/page_list_component/page_list_component_preview.rb index d9b192bbe..9195dd328 100644 --- a/spec/components/page_list_component/page_list_component_preview.rb +++ b/spec/components/page_list_component/page_list_component_preview.rb @@ -6,40 +6,40 @@ def default end def with_pages_and_no_conditions - pages = [build(:page, id: 1, position: 1, question_text: "Enter your name", routing_conditions: []), + pages = [ build(:page, id: 1, position: 1, question_text: "Enter your name", routing_conditions: []), build(:page, id: 2, position: 2, question_text: "What is your pet's phone number?", routing_conditions: []), - build(:page, id: 3, position: 3, question_text: "How many pets do you own?", routing_conditions: [])] + build(:page, id: 3, position: 3, question_text: "How many pets do you own?", routing_conditions: []) ] render(PageListComponent::View.new(pages:, form_id: 0)) end def with_pages_and_one_condition - routing_conditions = [(build :condition, id: 1, routing_page_id: 1, check_page_id: 1, answer_value: "Wales", goto_page_id: 3)] - pages = [build(:page, id: 1, position: 1, question_text: "Enter your name", routing_conditions:), + routing_conditions = [ (build :condition, id: 1, routing_page_id: 1, check_page_id: 1, answer_value: "Wales", goto_page_id: 3) ] + pages = [ build(:page, id: 1, position: 1, question_text: "Enter your name", routing_conditions:), build(:page, id: 2, position: 2, question_text: "What is your pet's phone number?", routing_conditions: []), - build(:page, id: 3, position: 3, question_text: "How many pets do you own?", routing_conditions: [])] + build(:page, id: 3, position: 3, question_text: "How many pets do you own?", routing_conditions: []) ] render(PageListComponent::View.new(pages:, form_id: 0)) end def with_pages_and_multiple_conditions - routing_conditions_1 = [(build :condition, id: 1, routing_page_id: 1, check_page_id: 1, answer_value: "Wales", goto_page_id: 3), - (build :condition, id: 2, routing_page_id: 1, check_page_id: 1, answer_value: "England", goto_page_id: 2)] - routing_conditions_2 = [(build :condition, id: 3, routing_page_id: 2, check_page_id: 2, answer_value: "Wales", goto_page_id: 3), - (build :condition, id: 4, routing_page_id: 2, check_page_id: 2, answer_value: "England", goto_page_id: 2)] - pages = [(build :page, id: 1, position: 1, question_text: "Enter your name", routing_conditions: routing_conditions_1), + routing_conditions_1 = [ (build :condition, id: 1, routing_page_id: 1, check_page_id: 1, answer_value: "Wales", goto_page_id: 3), + (build :condition, id: 2, routing_page_id: 1, check_page_id: 1, answer_value: "England", goto_page_id: 2) ] + routing_conditions_2 = [ (build :condition, id: 3, routing_page_id: 2, check_page_id: 2, answer_value: "Wales", goto_page_id: 3), + (build :condition, id: 4, routing_page_id: 2, check_page_id: 2, answer_value: "England", goto_page_id: 2) ] + pages = [ (build :page, id: 1, position: 1, question_text: "Enter your name", routing_conditions: routing_conditions_1), (build :page, id: 2, position: 2, question_text: "What is your pet's phone number?", routing_conditions: routing_conditions_2), - (build :page, id: 3, position: 3, question_text: "How many pets do you own?", routing_conditions: [])] + (build :page, id: 3, position: 3, question_text: "How many pets do you own?", routing_conditions: []) ] render(PageListComponent::View.new(pages:, form_id: 0)) end def with_pages_and_conditions_with_errors - routing_conditions_1 = [(build :condition, :with_answer_value_missing, id: 1, routing_page_id: 1, check_page_id: 1, goto_page_id: 3), + routing_conditions_1 = [ (build :condition, :with_answer_value_missing, id: 1, routing_page_id: 1, check_page_id: 1, goto_page_id: 3), (build :condition, :with_goto_page_missing, id: 2, routing_page_id: 1, check_page_id: 1, answer_value: "England"), (build :condition, :with_answer_value_and_goto_page_missing, id: 3, routing_page_id: 1, check_page_id: 1), - (build :condition, :with_goto_page_immediately_after_check_page, id: 5, routing_page_id: 1, check_page_id: 1, answer_value: "Wales", goto_page_id: 2)] - routing_conditions_2 = [(build :condition, :with_goto_page_before_check_page, id: 4, routing_page_id: 2, check_page_id: 2, answer_value: "England", goto_page_id: 1)] - pages = [(build :page, id: 1, position: 1, question_text: "Enter your name", routing_conditions: routing_conditions_1), + (build :condition, :with_goto_page_immediately_after_check_page, id: 5, routing_page_id: 1, check_page_id: 1, answer_value: "Wales", goto_page_id: 2) ] + routing_conditions_2 = [ (build :condition, :with_goto_page_before_check_page, id: 4, routing_page_id: 2, check_page_id: 2, answer_value: "England", goto_page_id: 1) ] + pages = [ (build :page, id: 1, position: 1, question_text: "Enter your name", routing_conditions: routing_conditions_1), (build :page, id: 2, position: 2, question_text: "What is your pet's phone number?", routing_conditions: routing_conditions_2), - (build :page, id: 3, position: 3, question_text: "How many pets do you own?", routing_conditions: [])] + (build :page, id: 3, position: 3, question_text: "How many pets do you own?", routing_conditions: []) ] render(PageListComponent::View.new(pages:, form_id: 0)) end end diff --git a/spec/components/page_list_component/view_spec.rb b/spec/components/page_list_component/view_spec.rb index c4345b0bb..15a204b68 100644 --- a/spec/components/page_list_component/view_spec.rb +++ b/spec/components/page_list_component/view_spec.rb @@ -17,7 +17,7 @@ end context "when the form has a single page" do - let(:pages) { [(build :page, id: 1, position: 1, question_text: "Enter your name?")] } + let(:pages) { [ (build :page, id: 1, position: 1, question_text: "Enter your name?") ] } it "renders the question number" do expect(page).to have_css("dt.govuk-summary-list__key", text: "1") @@ -38,7 +38,7 @@ end context "when the form has multiple pages" do - let(:pages) { [(build :page, id: 1, position: 1, question_text: "Enter your name?"), (build :page, id: 2, position: 2, question_text: "What is you pet's name?")] } + let(:pages) { [ (build :page, id: 1, position: 1, question_text: "Enter your name?"), (build :page, id: 2, position: 2, question_text: "What is you pet's name?") ] } it "renders the question numbers" do expect(page).to have_css("dt.govuk-summary-list__key", text: "1") @@ -55,9 +55,9 @@ context "when the form has conditions" do let(:pages) do - [(build :page, id: 1, position: 1, question_text: "What country do you live in?", routing_conditions:), + [ (build :page, id: 1, position: 1, question_text: "What country do you live in?", routing_conditions:), (build :page, id: 2, position: 2, question_text: "What is your name?", routing_conditions:), - (build :page, id: 3, position: 3, question_text: "What is your pet's name?", routing_conditions:)] + (build :page, id: 3, position: 3, question_text: "What is your pet's name?", routing_conditions:) ] end let(:edit_condition_path) { "/forms/0/pages/1/conditions/1" } @@ -68,7 +68,7 @@ end context "when the page has a single condition" do - let(:routing_conditions) { [(build :condition, id: 1, routing_page_id: 1, check_page_id: 1, answer_value: "Wales", goto_page_id: 3)] } + let(:routing_conditions) { [ (build :condition, id: 1, routing_page_id: 1, check_page_id: 1, answer_value: "Wales", goto_page_id: 3) ] } it "does not render any errors" do expect(page).not_to have_css(".app-page_list__route-text--error") @@ -93,7 +93,7 @@ end context "when the page has a condition with no answer_value" do - let(:routing_conditions) { [(build :condition, :with_answer_value_missing, id: 1, routing_page_id: 1, check_page_id: 1, goto_page_id: 3)] } + let(:routing_conditions) { [ (build :condition, :with_answer_value_missing, id: 1, routing_page_id: 1, check_page_id: 1, goto_page_id: 3) ] } it "renders the errors in an unordered list" do condition_answer_value_error = I18n.t("page_conditions.errors.page_list.answer_value_doesnt_exist", page_index: 1) @@ -112,7 +112,7 @@ end context "when the page has a condition with no goto_page set" do - let(:routing_conditions) { [(build :condition, :with_goto_page_missing, id: 1, routing_page_id: 1, check_page_id: 1, answer_value: "Wales")] } + let(:routing_conditions) { [ (build :condition, :with_goto_page_missing, id: 1, routing_page_id: 1, check_page_id: 1, answer_value: "Wales") ] } it "renders the errors in an unordered list" do condition_goto_page_error = I18n.t("page_conditions.errors.page_list.goto_page_doesnt_exist", page_index: 1) @@ -131,7 +131,7 @@ end context "when the page has a condition with multiple errors" do - let(:routing_conditions) { [(build :condition, :with_answer_value_and_goto_page_missing, id: 1, routing_page_id: 1, check_page_id: 1)] } + let(:routing_conditions) { [ (build :condition, :with_answer_value_and_goto_page_missing, id: 1, routing_page_id: 1, check_page_id: 1) ] } it "renders the errors in an unordered list" do condition_answer_value_error = I18n.t("page_conditions.errors.page_list.answer_value_doesnt_exist", page_index: 1) @@ -150,9 +150,9 @@ describe "class methods" do let(:pages) do - [(build :page, id: 1, position: 1, question_text: "What country do you live in?", routing_conditions:), + [ (build :page, id: 1, position: 1, question_text: "What country do you live in?", routing_conditions:), (build :page, id: 2, position: 2, question_text: "What is your name?", routing_conditions:), - (build :page, id: 3, position: 3, question_text: "What is your pet's name?", routing_conditions:)] + (build :page, id: 3, position: 3, question_text: "What is your pet's name?", routing_conditions:) ] end describe "show_up_button" do @@ -293,7 +293,7 @@ describe "#conditions_for_page_with_index" do context "when there are no conditions" do let(:pages) do - [(build :page, id: 1, position: 1, question_text: "What country do you live in?", routing_conditions:)] + [ (build :page, id: 1, position: 1, question_text: "What country do you live in?", routing_conditions:) ] end let(:routing_conditions) { [] } @@ -305,19 +305,19 @@ context "when there is one page with one condition" do let(:pages) do - [(build :page, id: 1, position: 1, question_text: "What country do you live in?", routing_conditions:)] + [ (build :page, id: 1, position: 1, question_text: "What country do you live in?", routing_conditions:) ] end - let(:routing_conditions) { [build(:condition, id: 1, routing_page_id: 1, check_page_id: 1, answer_value: "Wales", goto_page_id: 3)] } + let(:routing_conditions) { [ build(:condition, id: 1, routing_page_id: 1, check_page_id: 1, answer_value: "Wales", goto_page_id: 3) ] } it "returns an array of conditions for the page" do page_id = 1 - expect(page_list_component.conditions_for_page_with_index(page_id)).to eq([[routing_conditions.first, 1]]) + expect(page_list_component.conditions_for_page_with_index(page_id)).to eq([ [ routing_conditions.first, 1 ] ]) end end context "when there is one page with multiple conditions" do let(:pages) do - [(build :page, id: 1, position: 1, question_text: "What country do you live in?", routing_conditions:)] + [ (build :page, id: 1, position: 1, question_text: "What country do you live in?", routing_conditions:) ] end let(:routing_conditions) do @@ -329,13 +329,13 @@ it "returns the correct condition with index" do page_id = 2 - expect(page_list_component.conditions_for_page_with_index(page_id)).to eq([[routing_conditions.second, 2]]) + expect(page_list_component.conditions_for_page_with_index(page_id)).to eq([ [ routing_conditions.second, 2 ] ]) end end context "when there is one page with one condition and a condition for another pages" do let(:pages) do - [(build :page, id: 1, position: 1, question_text: "What country do you live in?", routing_conditions:)] + [ (build :page, id: 1, position: 1, question_text: "What country do you live in?", routing_conditions:) ] end let(:routing_conditions) do [ @@ -346,7 +346,7 @@ it "returns an array of conditions for the page" do page_id = 1 - expect(page_list_component.conditions_for_page_with_index(page_id)).to eq([[routing_conditions.first, 1]]) + expect(page_list_component.conditions_for_page_with_index(page_id)).to eq([ [ routing_conditions.first, 1 ] ]) end end end diff --git a/spec/components/page_settings_summary_component/page_settings_summary_component_preview.rb b/spec/components/page_settings_summary_component/page_settings_summary_component_preview.rb index 41aff7b65..d581c2fa7 100644 --- a/spec/components/page_settings_summary_component/page_settings_summary_component_preview.rb +++ b/spec/components/page_settings_summary_component/page_settings_summary_component_preview.rb @@ -9,8 +9,8 @@ def with_selection_answer_type is_optional: "false", answer_type: "selection", answer_settings: { only_one_option: "true", - selection_options: [{ name: "Option 1" }, - { name: "Option 2" }] }) + selection_options: [ { name: "Option 1" }, + { name: "Option 2" } ] }) render(PageSettingsSummaryComponent::View.new(draft_question:)) end @@ -19,7 +19,7 @@ def with_selection_answer_type_and_10_or_more_options is_optional: "false", answer_type: "selection", answer_settings: { only_one_option: "true", - selection_options: [{ name: "Option 1" }, + selection_options: [ { name: "Option 1" }, { name: "Option 2" }, { name: "Option 3" }, { name: "Option 4" }, @@ -28,7 +28,7 @@ def with_selection_answer_type_and_10_or_more_options { name: "Option 7" }, { name: "Option 8" }, { name: "Option 9" }, - { name: "Option 10" }] }) + { name: "Option 10" } ] }) render(PageSettingsSummaryComponent::View.new(draft_question:)) end diff --git a/spec/components/page_settings_summary_component/view_spec.rb b/spec/components/page_settings_summary_component/view_spec.rb index aabaf308e..d116c1f31 100644 --- a/spec/components/page_settings_summary_component/view_spec.rb +++ b/spec/components/page_settings_summary_component/view_spec.rb @@ -60,7 +60,7 @@ is_optional:, answer_settings: { only_one_option:, - selection_options: [{ name: "Option 1" }, { name: "Option 2" }], + selection_options: [ { name: "Option 1" }, { name: "Option 2" } ], } end @@ -74,7 +74,7 @@ build :selection_draft_question, answer_settings: { only_one_option:, - selection_options: [{ name: "Option 1" }, + selection_options: [ { name: "Option 1" }, { name: "Option 2" }, { name: "Option 3" }, { name: "Option 4" }, @@ -83,7 +83,7 @@ { name: "Option 7" }, { name: "Option 8" }, { name: "Option 9" }, - { name: "Option 10" }], + { name: "Option 10" } ], } end @@ -105,7 +105,7 @@ end context "when there is an error for the selection options" do - let(:selection_options_error_messages) { ["A selection options error"] } + let(:selection_options_error_messages) { [ "A selection options error" ] } it("highlights the summary list row with error formatting") do expect(page).to have_css(".govuk-summary-list__row.govuk-form-group--error", text: "Options") diff --git a/spec/components/preview_link_component/preview_link_component_preview.rb b/spec/components/preview_link_component/preview_link_component_preview.rb index e4e2de752..c34fda455 100644 --- a/spec/components/preview_link_component/preview_link_component_preview.rb +++ b/spec/components/preview_link_component/preview_link_component_preview.rb @@ -4,7 +4,7 @@ def without_pages end def with_pages - pages = [{ id: 183, question_text: "What is your address?", hint_text: "", answer_type: "address", next_page: nil }] + pages = [ { id: 183, question_text: "What is your address?", hint_text: "", answer_type: "address", next_page: nil } ] render(PreviewLinkComponent::View.new(pages, "https://submit.forms.service.gov.uk/example-form")) end end diff --git a/spec/components/preview_link_component/view_spec.rb b/spec/components/preview_link_component/view_spec.rb index c308c5f86..678393b29 100644 --- a/spec/components/preview_link_component/view_spec.rb +++ b/spec/components/preview_link_component/view_spec.rb @@ -5,7 +5,7 @@ context "when the form has pages" do it "renders the link" do - render_inline(described_class.new([{ id: 183, question_text: "What is your address?", hint_text: "", answer_type: "address", next_page: nil }], preview_url)) + render_inline(described_class.new([ { id: 183, question_text: "What is your address?", hint_text: "", answer_type: "address", next_page: nil } ], preview_url)) expect(page).to have_link("Preview this form", href: preview_url) end end diff --git a/spec/components/task_list_component/task_list_component_preview.rb b/spec/components/task_list_component/task_list_component_preview.rb index bdbd2cd46..1203bb139 100644 --- a/spec/components/task_list_component/task_list_component_preview.rb +++ b/spec/components/task_list_component/task_list_component_preview.rb @@ -36,12 +36,12 @@ def blank end def section_with_body_instead_of_rows - render(TaskListComponent::View.new(sections: [{ + render(TaskListComponent::View.new(sections: [ { title: "Section with body instead of rows", body_text: "There are no tasks for you to do yet.\n\nMaybe there will be some later.", section_number: 1, subsection: false, - }])) + } ])) end def section_without_body_or_rows diff --git a/spec/components/task_list_component/view_spec.rb b/spec/components/task_list_component/view_spec.rb index 2de3f08fb..4d31e94bb 100644 --- a/spec/components/task_list_component/view_spec.rb +++ b/spec/components/task_list_component/view_spec.rb @@ -66,12 +66,12 @@ end it "can render HTML in the section body" do - render_inline(described_class.new(sections: [{ + render_inline(described_class.new(sections: [ { title: "section title", section_number: 1, subsection: false, body_text: "section\n\nbody", - }])) + } ])) expect(page).to have_css("p", exact_text: "body") end diff --git a/spec/controller/application_controller_spec.rb b/spec/controller/application_controller_spec.rb index 7c6b189c8..5858fb8bc 100644 --- a/spec/controller/application_controller_spec.rb +++ b/spec/controller/application_controller_spec.rb @@ -8,15 +8,15 @@ describe "#user_ip" do [ - ["", nil], - ["127.0.0.1", "127.0.0.1"], - ["127.0.0.1, 192.168.0.128", "127.0.0.1"], - ["185.93.3.65, 15.158.44.215, 10.0.1.94", "185.93.3.65"], - [" 185.93.3.65, 15.158.44.215, 10.0.1.94", nil], - ["invalid value, 192.168.0.128", nil], - ["192.168.0.128.123.2981", nil], - ["2001:db8::, 2001:db8:3333:4444:CCCC:DDDD:EEEE:FFFF, ::1234:5678", "2001:db8::"], - [",,,,,,,,,,,,,,,,,,,,,,,,", nil], + [ "", nil ], + [ "127.0.0.1", "127.0.0.1" ], + [ "127.0.0.1, 192.168.0.128", "127.0.0.1" ], + [ "185.93.3.65, 15.158.44.215, 10.0.1.94", "185.93.3.65" ], + [ " 185.93.3.65, 15.158.44.215, 10.0.1.94", nil ], + [ "invalid value, 192.168.0.128", nil ], + [ "192.168.0.128.123.2981", nil ], + [ "2001:db8::, 2001:db8:3333:4444:CCCC:DDDD:EEEE:FFFF, ::1234:5678", "2001:db8::" ], + [ ",,,,,,,,,,,,,,,,,,,,,,,,", nil ], ].each do |value, expected| it "returns #{expected.inspect} when given forwarded_for #{value.inspect}" do expect(application_controller.user_ip(value)).to eq(expected) diff --git a/spec/factories/models/conditions.rb b/spec/factories/models/conditions.rb index d14be6cba..8fd83c573 100644 --- a/spec/factories/models/conditions.rb +++ b/spec/factories/models/conditions.rb @@ -11,29 +11,29 @@ trait :with_answer_value_missing do answer_value { nil } has_routing_errors { true } - validation_errors { [OpenStruct.new(name: "answer_value_doesnt_exist")] } + validation_errors { [ OpenStruct.new(name: "answer_value_doesnt_exist") ] } end trait :with_goto_page_missing do goto_page_id { nil } has_routing_errors { true } - validation_errors { [OpenStruct.new(name: "goto_page_doesnt_exist")] } + validation_errors { [ OpenStruct.new(name: "goto_page_doesnt_exist") ] } end trait :with_goto_page_before_check_page do has_routing_errors { true } - validation_errors { [OpenStruct.new(name: "cannot_have_goto_page_before_routing_page")] } + validation_errors { [ OpenStruct.new(name: "cannot_have_goto_page_before_routing_page") ] } end trait :with_goto_page_immediately_after_check_page do has_routing_errors { true } - validation_errors { [OpenStruct.new(name: "cannot_route_to_next_page")] } + validation_errors { [ OpenStruct.new(name: "cannot_route_to_next_page") ] } end trait :with_answer_value_and_goto_page_missing do goto_page_id { nil } has_routing_errors { true } - validation_errors { [OpenStruct.new(name: "answer_value_doesnt_exist"), OpenStruct.new(name: "goto_page_doesnt_exist")] } + validation_errors { [ OpenStruct.new(name: "answer_value_doesnt_exist"), OpenStruct.new(name: "goto_page_doesnt_exist") ] } end end end diff --git a/spec/factories/models/draft_questions.rb b/spec/factories/models/draft_questions.rb index 09da9d44b..38e95d1f7 100644 --- a/spec/factories/models/draft_questions.rb +++ b/spec/factories/models/draft_questions.rb @@ -57,7 +57,7 @@ factory :selection_draft_question do question_text { Faker::Lorem.question } answer_type { "selection" } - answer_settings { { only_one_option: "true", selection_options: [{ name: "Option 1" }, { name: "Option 2" }] } } + answer_settings { { only_one_option: "true", selection_options: [ { name: "Option 1" }, { name: "Option 2" } ] } } end factory :text_draft_question do diff --git a/spec/factories/models/pages.rb b/spec/factories/models/pages.rb index 0ad4b000d..03175c523 100644 --- a/spec/factories/models/pages.rb +++ b/spec/factories/models/pages.rb @@ -40,7 +40,7 @@ def as_json(*args) trait :with_selection_settings do transient do only_one_option { "true" } - selection_options { [{ name: "Option 1" }, { name: "Option 2" }] } + selection_options { [ { name: "Option 1" }, { name: "Option 2" } ] } end question_text { Faker::Lorem.question } diff --git a/spec/features/account/complete_user_account_spec.rb b/spec/features/account/complete_user_account_spec.rb index 90ca3c6b3..e3cb7b899 100644 --- a/spec/features/account/complete_user_account_spec.rb +++ b/spec/features/account/complete_user_account_spec.rb @@ -7,7 +7,7 @@ let(:form) { build :form, id: 1, name: "a form I created when I didn't have an organisation", created_at: "2024-10-08T07:31:15.762Z" } before do - allow(FormRepository).to receive_messages(where: [form], find: form, pages: form.pages) + allow(FormRepository).to receive_messages(where: [ form ], find: form, pages: form.pages) OmniAuth.config.test_mode = true OmniAuth.config.mock_auth[:auth0] = Faker::Omniauth.auth0( diff --git a/spec/features/form/add_or_edit_questions/edit_answer_settings_for_existing_questions_spec.rb b/spec/features/form/add_or_edit_questions/edit_answer_settings_for_existing_questions_spec.rb index a619bdf73..007d88103 100644 --- a/spec/features/form/add_or_edit_questions/edit_answer_settings_for_existing_questions_spec.rb +++ b/spec/features/form/add_or_edit_questions/edit_answer_settings_for_existing_questions_spec.rb @@ -29,7 +29,7 @@ let(:name_question) { build(:page, :with_name_settings, form_id: 1, input_type: "first_middle_and_last_name", title_needed: "true") } let(:selection_question) { build(:page, :with_selection_settings, form_id: 1, is_optional: true) } let(:text_question) { build(:page, :with_text_settings, form_id: 1, input_type: "long_text") } - let(:pages) { [address_question, date_question, name_question, selection_question, text_question] } + let(:pages) { [ address_question, date_question, name_question, selection_question, text_question ] } scenario "view answer_settings for each answer type and check the values are set" do when_i_viewing_an_existing_form diff --git a/spec/features/form/super_admin_view_forms_spec.rb b/spec/features/form/super_admin_view_forms_spec.rb index 560d6f98b..ea4fa0d09 100644 --- a/spec/features/form/super_admin_view_forms_spec.rb +++ b/spec/features/form/super_admin_view_forms_spec.rb @@ -1,10 +1,10 @@ require "rails_helper" feature "View forms", type: :feature do - let(:org_forms) { [build(:form, id: 1, name: "Org form")] } + let(:org_forms) { [ build(:form, id: 1, name: "Org form") ] } let(:other_org) { create :organisation, id: 2, slug: "Other org" } let(:other_org_user) { create :user, organisation: other_org } - let(:other_org_forms) { [build(:form, id: 2, name: "Other org form")] } + let(:other_org_forms) { [ build(:form, id: 2, name: "Other org form") ] } let(:other_org_group) { create :group, organisation_id: other_org.id } before do diff --git a/spec/features/groups/manage_group_members_spec.rb b/spec/features/groups/manage_group_members_spec.rb index 17e03f676..47b876e9c 100644 --- a/spec/features/groups/manage_group_members_spec.rb +++ b/spec/features/groups/manage_group_members_spec.rb @@ -54,7 +54,7 @@ def and_i_click_the_edit_group_members_link def then_i_should_see_the_members_of_the_group expect(page.find("h1")).to have_text "Group 1" - expect(page).to have_table(with_rows: [[existing_editor.name, existing_editor.email], [existing_group_admin.name, existing_group_admin.email]]) + expect(page).to have_table(with_rows: [ [ existing_editor.name, existing_editor.email ], [ existing_group_admin.name, existing_group_admin.email ] ]) expect_page_to_have_no_axe_errors(page) end @@ -91,17 +91,17 @@ def when_i_fill_in_the_add_group_admin_form def then_i_should_see_the_new_group_admin expect(page.find("h1")).to have_text "Group 1" - expect(page).to have_table(with_rows: [[new_user.email, "Group admin"]]) + expect(page).to have_table(with_rows: [ [ new_user.email, "Group admin" ] ]) end def then_i_should_see_the_user_as_editor expect(page.find("h1")).to have_text "Group 1" - expect(page).to have_table(with_rows: [[new_user.email, "Editor"]]) + expect(page).to have_table(with_rows: [ [ new_user.email, "Editor" ] ]) end def when_i_click_make_editor_for_user - within(:table_row, [new_user.email]) do + within(:table_row, [ new_user.email ]) do click_button "Make editor" end end diff --git a/spec/features/mou/view_signed_mous_spec.rb b/spec/features/mou/view_signed_mous_spec.rb index b5945f585..4f6b1347a 100644 --- a/spec/features/mou/view_signed_mous_spec.rb +++ b/spec/features/mou/view_signed_mous_spec.rb @@ -3,8 +3,8 @@ describe "Check which MOUs have been signed", type: :feature do let(:user) { super_admin_user } let!(:mou_signatures) do - [create(:mou_signature, created_at: Time.zone.parse("October 12, 2023")), - create(:mou_signature, created_at: Time.zone.parse("September 1, 2023"))] + [ create(:mou_signature, created_at: Time.zone.parse("October 12, 2023")), + create(:mou_signature, created_at: Time.zone.parse("September 1, 2023")) ] end before do diff --git a/spec/generator/custom_component_generator_spec.rb b/spec/generator/custom_component_generator_spec.rb index 8cd4e883a..bb02d0a40 100644 --- a/spec/generator/custom_component_generator_spec.rb +++ b/spec/generator/custom_component_generator_spec.rb @@ -27,7 +27,7 @@ end context "when the css argument is supplied" do - arguments ["my", "--css"] + arguments [ "my", "--css" ] it "creates the sass partial" do expect(File.read(File.join(destination_root, "app/components/my_component/_index.scss"))).to include("// Add styles here") @@ -35,7 +35,7 @@ end context "when the javascript argument is supplied" do - arguments ["my", "--javascript"] + arguments [ "my", "--javascript" ] it "creates the js file and test" do expect(File.read(File.join(destination_root, "app/components/my_component/index.js"))).to include("// Add JS here") diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb index 4f77267c3..d808a554a 100644 --- a/spec/helpers/application_helper_spec.rb +++ b/spec/helpers/application_helper_spec.rb @@ -206,8 +206,8 @@ it "returns the correct options" do expect(helper.user_role_options(%i[role1 role2])).to eq( - [OpenStruct.new(label: "name1", value: :role1, description: "description1"), - OpenStruct.new(label: "name2", value: :role2, description: "description2")], + [ OpenStruct.new(label: "name1", value: :role1, description: "description1"), + OpenStruct.new(label: "name2", value: :role2, description: "description2") ], ) end end diff --git a/spec/input_objects/forms/contact_details_input_spec.rb b/spec/input_objects/forms/contact_details_input_spec.rb index 82607e776..be16b8b8e 100644 --- a/spec/input_objects/forms/contact_details_input_spec.rb +++ b/spec/input_objects/forms/contact_details_input_spec.rb @@ -220,7 +220,7 @@ describe "#submit" do context "when invalid" do - subject(:contact_details_input) { build :contact_details_input, contact_details_supplied: [:supply_email], email: "invalid_email" } + subject(:contact_details_input) { build :contact_details_input, contact_details_supplied: [ :supply_email ], email: "invalid_email" } before do allow(FormRepository).to receive(:save!) diff --git a/spec/input_objects/forms/name_input_spec.rb b/spec/input_objects/forms/name_input_spec.rb index 4763040ec..a7c84d696 100644 --- a/spec/input_objects/forms/name_input_spec.rb +++ b/spec/input_objects/forms/name_input_spec.rb @@ -9,7 +9,7 @@ name_input.validate(:name) expect(name_input.errors.full_messages_for(:name)).to eq( - ["Name #{error_message}"], + [ "Name #{error_message}" ], ) end end diff --git a/spec/input_objects/group_member_input_spec.rb b/spec/input_objects/group_member_input_spec.rb index 88f250676..0fb617cca 100644 --- a/spec/input_objects/group_member_input_spec.rb +++ b/spec/input_objects/group_member_input_spec.rb @@ -60,7 +60,7 @@ before do membership_errors = instance_double(ActiveModel::Errors) error = instance_double(ActiveModel::Error, type: :user_in_other_org) - allow(membership_errors).to receive(:[]).with(:user_in_other_org).and_return(["User is already a member of another organization"]) + allow(membership_errors).to receive(:[]).with(:user_in_other_org).and_return([ "User is already a member of another organization" ]) allow(membership_errors).to receive(:each).and_yield(error) new_membership = instance_double(Membership, invalid?: true, errors: membership_errors) diff --git a/spec/input_objects/pages/conditions_input_spec.rb b/spec/input_objects/pages/conditions_input_spec.rb index 90da09537..2de763a60 100644 --- a/spec/input_objects/pages/conditions_input_spec.rb +++ b/spec/input_objects/pages/conditions_input_spec.rb @@ -11,7 +11,7 @@ second_page.answer_type = "selection" second_page.answer_settings = DataStruct.new( only_one_option: true, - selection_options: [OpenStruct.new(attributes: { name: "Option 1" }), OpenStruct.new(attributes: { name: "Option 2" })], + selection_options: [ OpenStruct.new(attributes: { name: "Option 1" }), OpenStruct.new(attributes: { name: "Option 2" }) ], ) end end diff --git a/spec/input_objects/pages/guidance_input_spec.rb b/spec/input_objects/pages/guidance_input_spec.rb index a3ada815f..a4511eb43 100644 --- a/spec/input_objects/pages/guidance_input_spec.rb +++ b/spec/input_objects/pages/guidance_input_spec.rb @@ -53,7 +53,7 @@ expect(guidance_input.errors.full_messages_for(:guidance_markdown)).to include("Guidance markdown #{error_message}") end - ["A" * 10, "A" * 250].each do |question_text| + [ "A" * 10, "A" * 250 ].each do |question_text| it "is valid if page_heading is less than or equal to 250 characters" do guidance_input.page_heading = question_text expect(guidance_input).to be_valid diff --git a/spec/input_objects/pages/question_text_input_spec.rb b/spec/input_objects/pages/question_text_input_spec.rb index cff500810..0580fce2a 100644 --- a/spec/input_objects/pages/question_text_input_spec.rb +++ b/spec/input_objects/pages/question_text_input_spec.rb @@ -9,7 +9,7 @@ end describe "validations" do - [nil, ""].each do |question_text| + [ nil, "" ].each do |question_text| it "is invalid given {question_text} question text" do error_message = I18n.t("activemodel.errors.models.pages/question_text_input.attributes.question_text.blank") question_text_input.question_text = question_text @@ -18,7 +18,7 @@ end end - ["A" * 10, "A" * 250].each do |question_text| + [ "A" * 10, "A" * 250 ].each do |question_text| it "is valid if question text is less than or equal to 250 characters" do question_text_input.question_text = question_text expect(question_text_input).to be_valid diff --git a/spec/input_objects/pages/routes/delete_confirmation_input_spec.rb b/spec/input_objects/pages/routes/delete_confirmation_input_spec.rb index 515b6a514..db4fd70d8 100644 --- a/spec/input_objects/pages/routes/delete_confirmation_input_spec.rb +++ b/spec/input_objects/pages/routes/delete_confirmation_input_spec.rb @@ -39,12 +39,12 @@ def build_pages end # primary route - pages[0].routing_conditions = [build(:condition, routing_page_id: 0, check_page_id: 0, goto_page_id: 4)] + pages[0].routing_conditions = [ build(:condition, routing_page_id: 0, check_page_id: 0, goto_page_id: 4) ] # secondary skip - pages[3].routing_conditions = [build(:condition, routing_page_id: 3, check_page_id: 0, goto_page_id: 4)] + pages[3].routing_conditions = [ build(:condition, routing_page_id: 3, check_page_id: 0, goto_page_id: 4) ] # unrelated condition - pages[2].routing_conditions = [build(:condition, routing_page_id: 2, check_page_id: 2, goto_page_id: 5)] + pages[2].routing_conditions = [ build(:condition, routing_page_id: 2, check_page_id: 2, goto_page_id: 5) ] pages end diff --git a/spec/input_objects/pages/secondary_skip_input_spec.rb b/spec/input_objects/pages/secondary_skip_input_spec.rb index f1c53fba6..bc3af0439 100644 --- a/spec/input_objects/pages/secondary_skip_input_spec.rb +++ b/spec/input_objects/pages/secondary_skip_input_spec.rb @@ -12,7 +12,7 @@ second_page.answer_type = "selection" second_page.answer_settings = DataStruct.new( only_one_option: true, - selection_options: [OpenStruct.new(attributes: { name: "Option 1" }), OpenStruct.new(attributes: { name: "Option 2" })], + selection_options: [ OpenStruct.new(attributes: { name: "Option 1" }), OpenStruct.new(attributes: { name: "Option 2" }) ], ) end end diff --git a/spec/input_objects/pages/selection/bulk_options_input_spec.rb b/spec/input_objects/pages/selection/bulk_options_input_spec.rb index ffc8ef63b..a2daff3b2 100644 --- a/spec/input_objects/pages/selection/bulk_options_input_spec.rb +++ b/spec/input_objects/pages/selection/bulk_options_input_spec.rb @@ -96,7 +96,7 @@ bulk_options_input.include_none_of_the_above = "true" bulk_options_input.submit - expect(bulk_options_input.draft_question.answer_settings[:selection_options]).to eq([{ name: "1" }, { name: "2" }]) + expect(bulk_options_input.draft_question.answer_settings[:selection_options]).to eq([ { name: "1" }, { name: "2" } ]) end it "logs submission" do @@ -123,7 +123,7 @@ expected_settings = { only_one_option:, - selection_options: [{ name: "1" }, { name: "2" }], + selection_options: [ { name: "1" }, { name: "2" } ], } expect(bulk_options_input.draft_question.answer_settings).to include(expected_settings) @@ -141,7 +141,7 @@ expected_settings = { only_one_option:, - selection_options: [{ name: "1" }, { name: "2" }], + selection_options: [ { name: "1" }, { name: "2" } ], } expect(bulk_options_input.draft_question.answer_settings).to include(expected_settings) @@ -152,7 +152,7 @@ describe "#none_of_the_above_options" do it "returns true and false as options" do - expect(bulk_options_input.none_of_the_above_options).to eq [OpenStruct.new(id: "true"), OpenStruct.new(id: "false")] + expect(bulk_options_input.none_of_the_above_options).to eq [ OpenStruct.new(id: "true"), OpenStruct.new(id: "false") ] end end diff --git a/spec/input_objects/pages/selection/options_input_spec.rb b/spec/input_objects/pages/selection/options_input_spec.rb index 6c47813b1..2ca458fb0 100644 --- a/spec/input_objects/pages/selection/options_input_spec.rb +++ b/spec/input_objects/pages/selection/options_input_spec.rb @@ -3,7 +3,7 @@ RSpec.describe Pages::Selection::OptionsInput do let(:only_one_option) { "true" } let(:draft_question) { build :draft_question, answer_type: "selection", answer_settings: { only_one_option: } } - let(:selection_options) { [{ name: "option 1" }, { name: "option 2" }] } + let(:selection_options) { [ { name: "option 1" }, { name: "option 2" } ] } describe "validations" do describe "include_none_of_the_above" do @@ -43,7 +43,7 @@ end it "is invalid if selection options are not unique" do - selection_options = [{ name: "option 1" }, { name: "option 2" }, { name: "option 1" }] + selection_options = [ { name: "option 1" }, { name: "option 2" }, { name: "option 1" } ] input = described_class.new(draft_question:, include_none_of_the_above: "true", selection_options:) error_message = I18n.t("activemodel.errors.models.pages/selection/options_input.attributes.selection_options.uniqueness") expect(input).not_to be_valid @@ -148,7 +148,7 @@ input = described_class.new(draft_question:, include_none_of_the_above: "true", selection_options:) input.add_another - expect(input.selection_options).to eq([{ name: "option 1" }, { name: "option 2" }, { name: "" }]) + expect(input.selection_options).to eq([ { name: "option 1" }, { name: "option 2" }, { name: "" } ]) end end @@ -157,17 +157,17 @@ input = described_class.new(draft_question:, include_none_of_the_above: "true", selection_options:) input.remove(1) - expect(input.selection_options.to_json).to eq([{ name: "option 1" }].to_json) + expect(input.selection_options.to_json).to eq([ { name: "option 1" } ].to_json) end end describe "#filter_out_blank_options" do it "filters out blank inputs" do - selection_options = [{ name: "1" }, { name: "" }, { name: "2" }] + selection_options = [ { name: "1" }, { name: "" }, { name: "2" } ] input = described_class.new(draft_question:, include_none_of_the_above: "true", selection_options:) input.validate - expect(input.selection_options.to_json).to eq([{ name: "1" }, { name: "2" }].to_json) + expect(input.selection_options.to_json).to eq([ { name: "1" }, { name: "2" } ].to_json) end end diff --git a/spec/integration/gds_sso_spec.rb b/spec/integration/gds_sso_spec.rb index 4a4491941..3edc86288 100644 --- a/spec/integration/gds_sso_spec.rb +++ b/spec/integration/gds_sso_spec.rb @@ -20,7 +20,7 @@ }, extra: { user: { - permissions: ["---"], + permissions: [ "---" ], organisation_slug: "test-org", organisation_content_id: "00000000-0000-0000-0000-000000000000", disabled: false, @@ -81,7 +81,7 @@ uid: "123456", email: "test@example.com", name: "Test User", - permissions: ["---"], + permissions: [ "---" ], organisation_slug: "test-org", organisation_content_id: "00000000-0000-0000-0000-000000000000", disabled: false, diff --git a/spec/lib/email_parameter_filter_proc_spec.rb b/spec/lib/email_parameter_filter_proc_spec.rb index 1c045ceed..1760462d2 100644 --- a/spec/lib/email_parameter_filter_proc_spec.rb +++ b/spec/lib/email_parameter_filter_proc_spec.rb @@ -5,7 +5,7 @@ RSpec.describe EmailParameterFilterProc do let(:email_parameter_filter) do ActiveSupport::ParameterFilter.new( - [described_class.new], + [ described_class.new ], ) end @@ -29,7 +29,7 @@ let(:email_parameter_filter) do ActiveSupport::ParameterFilter.new( - [described_class.new(mask:)], mask: + [ described_class.new(mask:) ], mask: ) end diff --git a/spec/lib/mailchimp_list_synchronizer_spec.rb b/spec/lib/mailchimp_list_synchronizer_spec.rb index da13d8e90..9e4a3bf91 100644 --- a/spec/lib/mailchimp_list_synchronizer_spec.rb +++ b/spec/lib/mailchimp_list_synchronizer_spec.rb @@ -108,7 +108,7 @@ end context "when the user is in the list of users to synchronize" do - let(:users_to_synchronize) { ["user@domain.org"] } + let(:users_to_synchronize) { [ "user@domain.org" ] } context "when the user is not present in the MailChimp list" do let(:list_1_members_info) do @@ -194,7 +194,7 @@ end context "when the user is not in the list of users to synchronize" do - let(:users_to_synchronize) { ["some_other_user@domain.org"] } + let(:users_to_synchronize) { [ "some_other_user@domain.org" ] } context "when the user is not present in the MailChimp list" do let(:list_1_members_info) do @@ -281,7 +281,7 @@ context "when the mailing list has more than 1000 members" do let(:users_to_synchronize) do - ["some_email_address@domain.org"] + [ "some_email_address@domain.org" ] end let(:list_1) do diff --git a/spec/lib/omniauth/strategies/username_and_password_spec.rb b/spec/lib/omniauth/strategies/username_and_password_spec.rb index 8062f7c3f..16e41c318 100644 --- a/spec/lib/omniauth/strategies/username_and_password_spec.rb +++ b/spec/lib/omniauth/strategies/username_and_password_spec.rb @@ -13,9 +13,9 @@ end b.run do |env| if !env.include?("omniauth.strategy") - [404, {}, ["Not Found"]] + [ 404, {}, [ "Not Found" ] ] else - [200, {}, %w[OK]] + [ 200, {}, %w[OK] ] end end }.to_app diff --git a/spec/lib/tasks/forms.rake_spec.rb b/spec/lib/tasks/forms.rake_spec.rb index 85e31e11a..659421c4c 100644 --- a/spec/lib/tasks/forms.rake_spec.rb +++ b/spec/lib/tasks/forms.rake_spec.rb @@ -32,7 +32,7 @@ context "with valid arguments" do context "with a single form not in a group" do let(:form_id) { form_ids.first } - let(:valid_args) { [form_id, group.external_id] } + let(:valid_args) { [ form_id, group.external_id ] } it "adds the form to the group" do expect { @@ -46,7 +46,7 @@ context "with a single form already in a group" do let(:form_id) { form_ids.first } let(:old_group) { create :group } - let(:valid_args) { [form_id, group.external_id] } + let(:valid_args) { [ form_id, group.external_id ] } before do GroupForm.create! form_id:, group: old_group @@ -64,7 +64,7 @@ context "with a single form already in the target group" do let(:form_id) { form_ids.first } - let(:valid_args) { [form_id, group.external_id] } + let(:valid_args) { [ form_id, group.external_id ] } before do GroupForm.create! form_id:, group: @@ -81,7 +81,7 @@ end context "with a multiple forms" do - let(:valid_args) { [*form_ids, group.external_id] } + let(:valid_args) { [ *form_ids, group.external_id ] } it "adds each form to the group" do task.invoke(*valid_args) @@ -112,12 +112,12 @@ context "with only one argument" do it_behaves_like "usage error" do - let(:invalid_args) { [form_ids.first] } + let(:invalid_args) { [ form_ids.first ] } end end context "with invalid group_id" do - let(:invalid_args) { [*form_ids, "not_a_group_id"] } + let(:invalid_args) { [ *form_ids, "not_a_group_id" ] } it "raises an error" do expect { @@ -127,7 +127,7 @@ end context "with invalid form_id" do - let(:invalid_args) { ["99", group.external_id] } + let(:invalid_args) { [ "99", group.external_id ] } before do ActiveResource::HttpMock.respond_to do |mock| @@ -163,7 +163,7 @@ context "with valid arguments" do let(:submission_email) { "test@example.gov.uk" } - let(:valid_args) { [form.id, submission_email] } + let(:valid_args) { [ form.id, submission_email ] } let(:request) do ActiveResource::HttpMock.requests.find do |request| @@ -238,12 +238,12 @@ context "with only one argument" do it_behaves_like "usage error" do - let(:invalid_args) { [form.id] } + let(:invalid_args) { [ form.id ] } end end context "with invalid form_id" do - let(:invalid_args) { ["99", "test@example.com"] } + let(:invalid_args) { [ "99", "test@example.com" ] } before do ActiveResource::HttpMock.respond_to do |mock| diff --git a/spec/lib/tasks/groups.rake_spec.rb b/spec/lib/tasks/groups.rake_spec.rb index 3e87e3026..00183239c 100644 --- a/spec/lib/tasks/groups.rake_spec.rb +++ b/spec/lib/tasks/groups.rake_spec.rb @@ -34,7 +34,7 @@ expect { task.invoke(*group_ids, target_org.id) - }.to change { groups.map { |g| g.reload.organisation } }.to([target_org] * groups.size) + }.to change { groups.map { |g| g.reload.organisation } }.to([ target_org ] * groups.size) end end end @@ -61,7 +61,7 @@ end it "aborts when any groups are not found" do - non_existent_group_ids = [999_998, 999_999] + non_existent_group_ids = [ 999_998, 999_999 ] expect { task.invoke(*non_existent_group_ids, target_org.id) @@ -131,7 +131,7 @@ let(:group) { create :group, organisation: source_organisation } context "with valid arguments" do - let(:valid_args) { [source_organisation.id, target_organisation.id] } + let(:valid_args) { [ source_organisation.id, target_organisation.id ] } it "moves the group to the new org" do expect { @@ -158,12 +158,12 @@ context "with only one argument" do it_behaves_like "usage error" do - let(:invalid_args) { [source_organisation.id] } + let(:invalid_args) { [ source_organisation.id ] } end end context "with invalid source_organisation id" do - let(:invalid_args) { ["some_id_that_does_not_exist", target_organisation.id] } + let(:invalid_args) { [ "some_id_that_does_not_exist", target_organisation.id ] } it "raises an error" do expect { @@ -174,7 +174,7 @@ end context "with invalid target_organisation id" do - let(:invalid_args) { [source_organisation.id, "some_id_that_does_not_exist"] } + let(:invalid_args) { [ source_organisation.id, "some_id_that_does_not_exist" ] } it "raises an error" do expect { @@ -195,7 +195,7 @@ let(:group) { create :group, organisation: source_organisation } context "with valid arguments" do - let(:valid_args) { [source_organisation.id, target_organisation.id] } + let(:valid_args) { [ source_organisation.id, target_organisation.id ] } it "does not persist the organisation change for the groups" do expect { @@ -222,12 +222,12 @@ context "with only one argument" do it_behaves_like "usage error" do - let(:invalid_args) { [source_organisation.id] } + let(:invalid_args) { [ source_organisation.id ] } end end context "with invalid source_organisation id" do - let(:invalid_args) { ["some_id_that_does_not_exist", target_organisation.id] } + let(:invalid_args) { [ "some_id_that_does_not_exist", target_organisation.id ] } it "raises an error" do expect { @@ -238,7 +238,7 @@ end context "with invalid target_organisation id" do - let(:invalid_args) { [source_organisation.id, "some_id_that_does_not_exist"] } + let(:invalid_args) { [ source_organisation.id, "some_id_that_does_not_exist" ] } it "raises an error" do expect { diff --git a/spec/lib/tasks/mailchimp.rake_spec.rb b/spec/lib/tasks/mailchimp.rake_spec.rb index e8b65731e..11b85a8c7 100644 --- a/spec/lib/tasks/mailchimp.rake_spec.rb +++ b/spec/lib/tasks/mailchimp.rake_spec.rb @@ -44,7 +44,7 @@ it "runs the mailchimp synchronization on each list" do expect(MailchimpListSynchronizer).to receive(:synchronize).with(list_id: Settings.mailchimp.active_users_list, users_to_synchronize: match_array(users_with_access)).once - expect(MailchimpListSynchronizer).to receive(:synchronize).with(list_id: Settings.mailchimp.mou_signers_list, users_to_synchronize: [mou_signer_with_access]).once + expect(MailchimpListSynchronizer).to receive(:synchronize).with(list_id: Settings.mailchimp.mou_signers_list, users_to_synchronize: [ mou_signer_with_access ]).once expect { task.invoke }.to output.to_stdout end diff --git a/spec/lib/tasks/organisations.rake_spec.rb b/spec/lib/tasks/organisations.rake_spec.rb index 72db392bd..57b69ecde 100644 --- a/spec/lib/tasks/organisations.rake_spec.rb +++ b/spec/lib/tasks/organisations.rake_spec.rb @@ -36,9 +36,9 @@ end [ - ["Global Test Organisation", "global-test-organisation"], - ["Testing, Validating and Verifying Service", "testing-validating-and-verifying-service"], - ["Head Tester’s Department", "head-tester-s-department"], + [ "Global Test Organisation", "global-test-organisation" ], + [ "Testing, Validating and Verifying Service", "testing-validating-and-verifying-service" ], + [ "Head Tester’s Department", "head-tester-s-department" ], ].each do |name, slug| describe "given organisation name \"#{name}\"" do it "generates the organisation slug \"#{slug}\"" do diff --git a/spec/mailers/group_member_mailer_spec.rb b/spec/mailers/group_member_mailer_spec.rb index dec1e4f1a..f064246b1 100644 --- a/spec/mailers/group_member_mailer_spec.rb +++ b/spec/mailers/group_member_mailer_spec.rb @@ -16,7 +16,7 @@ end it "sends an email to the new member" do - expect(mail.to).to eq([membership.user.email]) + expect(mail.to).to eq([ membership.user.email ]) end it "includes the group path" do @@ -43,7 +43,7 @@ expect(mail.govuk_notify_personalisation[role.to_sym]).to eq("yes") end - (Membership.roles.keys - [role]).each do |other_role| + (Membership.roles.keys - [ role ]).each do |other_role| it "#{other_role} are all set to no" do expect(mail.govuk_notify_personalisation[other_role.to_sym]).to eq("no") end diff --git a/spec/mailers/group_upgrade_mailer_spec.rb b/spec/mailers/group_upgrade_mailer_spec.rb index ef2b93870..8cc4873c0 100644 --- a/spec/mailers/group_upgrade_mailer_spec.rb +++ b/spec/mailers/group_upgrade_mailer_spec.rb @@ -25,7 +25,7 @@ end it "sends an email to the correct email address" do - expect(mail.to).to eq([to_email]) + expect(mail.to).to eq([ to_email ]) end end @@ -49,7 +49,7 @@ end it "sends an email to the correct email address" do - expect(mail.to).to eq([to_email]) + expect(mail.to).to eq([ to_email ]) end it "includes the personalisation" do @@ -80,7 +80,7 @@ end it "sends an email to the correct email address" do - expect(mail.to).to eq([to_email]) + expect(mail.to).to eq([ to_email ]) end it "includes the personalisation" do diff --git a/spec/mailers/submission_email_mailer_spec.rb b/spec/mailers/submission_email_mailer_spec.rb index f6788c55e..827a3d76b 100644 --- a/spec/mailers/submission_email_mailer_spec.rb +++ b/spec/mailers/submission_email_mailer_spec.rb @@ -18,7 +18,7 @@ end it "sends an email to the temporary submission email address" do - expect(mail.to).to eq(["test@example.com"]) + expect(mail.to).to eq([ "test@example.com" ]) end it "includes the confirmation code" do @@ -54,7 +54,7 @@ end it "sends an email to the live submission email address" do - expect(mail.to).to eq(["test@example.com"]) + expect(mail.to).to eq([ "test@example.com" ]) end it "includes the form creators details" do @@ -81,7 +81,7 @@ end it "sends an email to the live submission email address" do - expect(mail.to).to eq(["test@example.com"]) + expect(mail.to).to eq([ "test@example.com" ]) end it "includes the form name" do diff --git a/spec/models/group_spec.rb b/spec/models/group_spec.rb index 2dea06e59..95f27aa3e 100644 --- a/spec/models/group_spec.rb +++ b/spec/models/group_spec.rb @@ -43,7 +43,7 @@ group = build :group, organisation:, name: "Test group" expect(group).to be_invalid - expect(group.errors[:name]).to eq([I18n.t("activerecord.errors.models.group.attributes.name.taken")]) + expect(group.errors[:name]).to eq([ I18n.t("activerecord.errors.models.group.attributes.name.taken") ]) end it "is valid when two groups have the same name but different organisations" do @@ -236,7 +236,7 @@ create :membership, user:, group: group1 create :membership, user:, group: group2 - expect(described_class.for_user(user)).to eq [group1, group2] + expect(described_class.for_user(user)).to eq [ group1, group2 ] end it "returns an empty array if the user is not a member of any groups" do @@ -253,7 +253,7 @@ create :group create :membership, user:, group: group1 - expect(described_class.for_user(user)).to eq [group1] + expect(described_class.for_user(user)).to eq [ group1 ] end end @@ -264,7 +264,7 @@ group1 = create(:group) create(:group, organisation: org) - expect(described_class.for_organisation(group1.organisation)).to eq [group1] + expect(described_class.for_organisation(group1.organisation)).to eq [ group1 ] end it "returns no groups for an unused organisation" do @@ -300,7 +300,7 @@ group_b = create :group, organisation:, name: "b", creator: user group_a = create :group, organisation:, name: "a", creator: user - expect(described_class.for_organisation(group_c.organisation)).to eq [group_a, group_b, group_c] + expect(described_class.for_organisation(group_c.organisation)).to eq [ group_a, group_b, group_c ] end end end diff --git a/spec/models/organisation_spec.rb b/spec/models/organisation_spec.rb index 053fde9b1..a1f76539f 100644 --- a/spec/models/organisation_spec.rb +++ b/spec/models/organisation_spec.rb @@ -41,7 +41,7 @@ organisations_with_users = described_class.with_users - expect(organisations_with_users).to eq([organisation1, organisation2]) + expect(organisations_with_users).to eq([ organisation1, organisation2 ]) end end @@ -50,7 +50,7 @@ organisation = create :organisation create :organisation, slug: "closed-org", closed: true - expect(described_class.not_closed).to eq [organisation] + expect(described_class.not_closed).to eq [ organisation ] end end end diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 7d0ae9142..70c2af38f 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -198,7 +198,7 @@ expect(Rails.logger).to have_received(:info).with("User attributes updated upon authorisation", { "user_changes": { uid: %w[123456 111111], - name: ["Test User", "Test A. User"], + name: [ "Test User", "Test A. User" ], }, }) end diff --git a/spec/policies/form_policy_spec.rb b/spec/policies/form_policy_spec.rb index 7cbe82eaa..9fe384d12 100644 --- a/spec/policies/form_policy_spec.rb +++ b/spec/policies/form_policy_spec.rb @@ -110,13 +110,13 @@ let(:pages) { [] } context "and the form has one page" do - let(:pages) { [(build :page, position: 1, id: 1)] } + let(:pages) { [ (build :page, position: 1, id: 1) ] } it { is_expected.to forbid_actions(%i[can_add_page_routing_conditions]) } end context "and the form has two or more pages" do - let(:pages) { [(build :page, position: 1, id: 1), (build :page, position: 2, id: 2)] } + let(:pages) { [ (build :page, position: 1, id: 1), (build :page, position: 2, id: 2) ] } context "and the form does not have a selection question" do it { is_expected.to forbid_actions(%i[can_add_page_routing_conditions]) } @@ -136,14 +136,14 @@ context "and the form has a selection question without an existing route" do context "and the available selection question is the last page in the form" do - let(:pages) { [(build :page, position: 1, id: 1), (build :page, position: 2, id: 2), (build :page, :with_selection_settings, position: 3, id: 3)] } + let(:pages) { [ (build :page, position: 1, id: 1), (build :page, position: 2, id: 2), (build :page, :with_selection_settings, position: 3, id: 3) ] } it { is_expected.to forbid_actions(%i[can_add_page_routing_conditions]) } end context "and the available selection question is not the last page in the form" do - let(:routing_conditions) { [(build :condition, id: 1, check_page_id: 1, answer_value: "Wales", goto_pageid: 2)] } - let(:pages) { [(build :page, :with_selection_settings, position: 1, id: 1, routing_conditions:), (build :page, :with_selection_settings, position: 2, id: 2), (build :page, position: 3, id: 3)] } + let(:routing_conditions) { [ (build :condition, id: 1, check_page_id: 1, answer_value: "Wales", goto_pageid: 2) ] } + let(:pages) { [ (build :page, :with_selection_settings, position: 1, id: 1, routing_conditions:), (build :page, :with_selection_settings, position: 2, id: 2), (build :page, position: 3, id: 3) ] } it { is_expected.to permit_actions(%i[can_add_page_routing_conditions]) } end diff --git a/spec/policies/group_form_policy_spec.rb b/spec/policies/group_form_policy_spec.rb index 919b301af..eb10676d0 100644 --- a/spec/policies/group_form_policy_spec.rb +++ b/spec/policies/group_form_policy_spec.rb @@ -7,7 +7,7 @@ let(:group_form) { GroupForm.new(group:) } context "when user can access group" do - let(:user) { build :user, groups: [group] } + let(:user) { build :user, groups: [ group ] } it { is_expected.to permit_all_actions } end diff --git a/spec/presenters/form_list_presenter_spec.rb b/spec/presenters/form_list_presenter_spec.rb index 93abda5b7..b6de5efa7 100644 --- a/spec/presenters/form_list_presenter_spec.rb +++ b/spec/presenters/form_list_presenter_spec.rb @@ -16,9 +16,9 @@ describe "head" do it "contains a 'Name', `Created by` and 'Status' column heading" do - expect(presenter.data[:head]).to eq([I18n.t("home.form_name_heading"), + expect(presenter.data[:head]).to eq([ I18n.t("home.form_name_heading"), { text: I18n.t("home.created_by") }, - { text: I18n.t("home.form_status_heading"), numeric: true }]) + { text: I18n.t("home.form_status_heading"), numeric: true } ]) end end diff --git a/spec/requests/forms/contact_details_controller_spec.rb b/spec/requests/forms/contact_details_controller_spec.rb index 8018aba5e..b5487ea4f 100644 --- a/spec/requests/forms/contact_details_controller_spec.rb +++ b/spec/requests/forms/contact_details_controller_spec.rb @@ -56,7 +56,7 @@ end context "when given valid params" do - let(:params) { { forms_contact_details_input: { contact_details_supplied: ["", "supply_email"], email: "test@test.gov.uk", form: } } } + let(:params) { { forms_contact_details_input: { contact_details_supplied: [ "", "supply_email" ], email: "test@test.gov.uk", form: } } } it "reads the form" do expect(FormRepository).to have_received(:find) @@ -72,7 +72,7 @@ end context "when given invalid parameters" do - let(:params) { { forms_contact_details_input: { contact_details_supplied: ["", "supply_email"], email: "", form: } } } + let(:params) { { forms_contact_details_input: { contact_details_supplied: [ "", "supply_email" ], email: "", form: } } } it "reads the form" do expect(FormRepository).to have_received(:find) @@ -89,7 +89,7 @@ end context "when given an email address for a non-government inbox" do - let(:params) { { forms_contact_details_input: { contact_details_supplied: ["", "supply_email"], email: "a@gmail.com", form: } } } + let(:params) { { forms_contact_details_input: { contact_details_supplied: [ "", "supply_email" ], email: "a@gmail.com", form: } } } it "reads the form" do expect(FormRepository).to have_received(:find) @@ -113,7 +113,7 @@ standard_user end - let(:params) { { forms_contact_details_input: { contact_details_supplied: ["", "supply_email"], email: "a@public-sector-org.example", form: } } } + let(:params) { { forms_contact_details_input: { contact_details_supplied: [ "", "supply_email" ], email: "a@public-sector-org.example", form: } } } let(:updated_form) do form.tap do |f| diff --git a/spec/requests/forms/what_happens_next_controller_spec.rb b/spec/requests/forms/what_happens_next_controller_spec.rb index 741c7a399..7f4f6a832 100644 --- a/spec/requests/forms/what_happens_next_controller_spec.rb +++ b/spec/requests/forms/what_happens_next_controller_spec.rb @@ -180,7 +180,7 @@ let(:markdown) { "# A level one heading" } it "returns a JSON object containing the converted HTML" do - expect(response.body).to eq({ preview_html: "
A level one heading
", errors: [I18n.t("activemodel.errors.models.forms/what_happens_next_input.attributes.what_happens_next_markdown.unsupported_markdown_syntax")] }.to_json) + expect(response.body).to eq({ preview_html: "A level one heading
", errors: [ I18n.t("activemodel.errors.models.forms/what_happens_next_input.attributes.what_happens_next_markdown.unsupported_markdown_syntax") ] }.to_json) end it "returns 200" do diff --git a/spec/requests/forms_controller_spec.rb b/spec/requests/forms_controller_spec.rb index 4d583c913..52f145247 100644 --- a/spec/requests/forms_controller_spec.rb +++ b/spec/requests/forms_controller_spec.rb @@ -90,7 +90,7 @@ describe "#mark_pages_section_completed" do let(:pages) do - [build(:page, page_id: 99)] + [ build(:page, page_id: 99) ] end let(:form) do diff --git a/spec/requests/groups_controller_spec.rb b/spec/requests/groups_controller_spec.rb index a4bcfd4ee..eed60c5e5 100644 --- a/spec/requests/groups_controller_spec.rb +++ b/spec/requests/groups_controller_spec.rb @@ -16,7 +16,7 @@ let(:current_user) { standard_user } let(:role) { :editor } let(:status) { :trial } - let(:upgrade_requester) {} + let(:upgrade_requester) { } let(:member_group) do create(:group, organisation: current_user.organisation, status:, upgrade_requester:).tap do |group| create(:membership, user: current_user, group:, role:) diff --git a/spec/requests/pages/conditions_controller_spec.rb b/spec/requests/pages/conditions_controller_spec.rb index 071d7b26b..922d33af5 100644 --- a/spec/requests/pages/conditions_controller_spec.rb +++ b/spec/requests/pages/conditions_controller_spec.rb @@ -9,8 +9,8 @@ first_page.answer_type = "selection" first_page.answer_settings = DataStruct.new( only_one_option: true, - selection_options: [OpenStruct.new(attributes: { name: "Option 1" }), - OpenStruct.new(attributes: { name: "Option 2" })], + selection_options: [ OpenStruct.new(attributes: { name: "Option 1" }), + OpenStruct.new(attributes: { name: "Option 2" }) ], ) end end @@ -64,7 +64,7 @@ context "when the page already has a condition associated with it" do let(:selected_page) do - page.routing_conditions = [(build :condition, id: 1, check_page_id: page.id, goto_page_id: 2)] + page.routing_conditions = [ (build :condition, id: 1, check_page_id: page.id, goto_page_id: 2) ] page end @@ -121,7 +121,7 @@ context "when user should not be allowed to add routes to pages" do let(:form) { build :form, id: 1 } - let(:pages) { [build(:page)] } + let(:pages) { [ build(:page) ] } it "Renders the forbidden page" do expect(response).to render_template("errors/forbidden") @@ -172,7 +172,7 @@ context "when user should not be allowed to add routes to pages" do let(:form) { build :form, id: 1 } - let(:pages) { [build(:page)] } + let(:pages) { [ build(:page) ] } it "Renders the forbidden page" do expect(response).to render_template("errors/forbidden") @@ -191,7 +191,7 @@ let(:conditions_input) { @conditions_input } # rubocop:disable RSpec/InstanceVariable before do - selected_page.routing_conditions = [condition] + selected_page.routing_conditions = [ condition ] selected_page.position = 1 allow(PageRepository).to receive(:find).and_return(selected_page) @@ -241,7 +241,7 @@ let(:condition) { build :condition, id: 1, routing_page_id: pages.first.id, check_page_id: pages.first.id, answer_value: "Wales", goto_page_id: pages.last.id } before do - selected_page.routing_conditions = [condition] + selected_page.routing_conditions = [ condition ] selected_page.position = 1 allow(PageRepository).to receive(:find).and_return(selected_page) @@ -296,7 +296,7 @@ let(:condition) { build :condition, id: 1, routing_page_id: selected_page.id, check_page_id: selected_page.id, answer_value: "Wales", goto_page_id: 3 } before do - selected_page.routing_conditions = [condition] + selected_page.routing_conditions = [ condition ] selected_page.position = 1 allow(PageRepository).to receive(:find).and_return(selected_page) @@ -333,7 +333,7 @@ let(:destroy_bool) { true } before do - selected_page.routing_conditions = [condition] + selected_page.routing_conditions = [ condition ] selected_page.position = 1 allow(PageRepository).to receive(:find).and_return(selected_page) diff --git a/spec/requests/pages/guidance_controller_spec.rb b/spec/requests/pages/guidance_controller_spec.rb index 1093e226c..0683e2eae 100644 --- a/spec/requests/pages/guidance_controller_spec.rb +++ b/spec/requests/pages/guidance_controller_spec.rb @@ -283,7 +283,7 @@ let(:markdown) { "# A level one heading" } it "returns a JSON object containing the converted HTML" do - expect(response.body).to eq({ preview_html: "A level one heading
", errors: [I18n.t("activemodel.errors.models.pages/guidance_input.attributes.guidance_markdown.unsupported_markdown_syntax")] }.to_json) + expect(response.body).to eq({ preview_html: "A level one heading
", errors: [ I18n.t("activemodel.errors.models.pages/guidance_input.attributes.guidance_markdown.unsupported_markdown_syntax") ] }.to_json) end it "returns 200" do diff --git a/spec/requests/pages/questions_controller_spec.rb b/spec/requests/pages/questions_controller_spec.rb index 58096827b..014549f92 100644 --- a/spec/requests/pages/questions_controller_spec.rb +++ b/spec/requests/pages/questions_controller_spec.rb @@ -68,7 +68,7 @@ end let(:form_pages_response) do - [page_response] + [ page_response ] end let(:group) { create(:group, organisation: standard_user.organisation) } diff --git a/spec/requests/pages/routes_controller_spec.rb b/spec/requests/pages/routes_controller_spec.rb index 0ba5e479f..32b374a51 100644 --- a/spec/requests/pages/routes_controller_spec.rb +++ b/spec/requests/pages/routes_controller_spec.rb @@ -10,8 +10,8 @@ first_page.answer_type = "selection" first_page.answer_settings = DataStruct.new( only_one_option: true, - selection_options: [OpenStruct.new(attributes: { name: "Option 1" }), - OpenStruct.new(attributes: { name: "Option 2" })], + selection_options: [ OpenStruct.new(attributes: { name: "Option 1" }), + OpenStruct.new(attributes: { name: "Option 2" }) ], ) end end @@ -69,8 +69,8 @@ allow(ConditionRepository).to receive(:find).and_return(condition) allow(ConditionRepository).to receive(:destroy) - selected_page.routing_conditions = [condition] - secondary_skip_page.routing_conditions = [secondary_skip] + selected_page.routing_conditions = [ condition ] + secondary_skip_page.routing_conditions = [ secondary_skip ] end context "when confirmed" do diff --git a/spec/requests/pages/secondary_skip_controller_spec.rb b/spec/requests/pages/secondary_skip_controller_spec.rb index 31171112f..85cc9a668 100644 --- a/spec/requests/pages/secondary_skip_controller_spec.rb +++ b/spec/requests/pages/secondary_skip_controller_spec.rb @@ -345,7 +345,7 @@ def build_pages_with_existing_secondary_skip goto_page_id: pages[4].id, secondary_skip: true, ) - pages[1].routing_conditions = [existing_secondary_skip] + pages[1].routing_conditions = [ existing_secondary_skip ] end end end diff --git a/spec/requests/pages/selection/bulk_options_controller_spec.rb b/spec/requests/pages/selection/bulk_options_controller_spec.rb index a8e18bf50..7c87c843a 100644 --- a/spec/requests/pages/selection/bulk_options_controller_spec.rb +++ b/spec/requests/pages/selection/bulk_options_controller_spec.rb @@ -12,7 +12,7 @@ user: standard_user, form_id: form.id, is_optional: false, - answer_settings: { selection_options: [{ name: "" }, { name: "" }], + answer_settings: { selection_options: [ { name: "" }, { name: "" } ], only_one_option: "true" } end let(:page_id) { nil } @@ -60,7 +60,7 @@ user: standard_user, form_id: form.id, is_optional: true, - answer_settings: { selection_options: [{ name: "Option 1" }, { name: "Option 2" }], + answer_settings: { selection_options: [ { name: "Option 1" }, { name: "Option 2" } ], only_one_option: "true" } end @@ -88,7 +88,7 @@ draft_question_settings = settings_form.draft_question.answer_settings expect(draft_question_settings).to include(only_one_option: "true", - selection_options: [{ name: "Option 1" }, { name: "Option 2" }]) + selection_options: [ { name: "Option 1" }, { name: "Option 2" } ]) expect(settings_form.draft_question.is_optional).to be false end @@ -111,7 +111,7 @@ describe "#edit" do let(:page) { build :page, :with_selection_settings, id: 2, form_id: form.id, answer_settings: } let(:answer_settings) { { selection_options: } } - let(:selection_options) { [{ name: "Option 1" }, { name: "Option 2" }] } + let(:selection_options) { [ { name: "Option 1" }, { name: "Option 2" } ] } let(:page_id) { page.id } before do @@ -149,7 +149,7 @@ describe "#update" do let(:page) { build :page, :with_selection_settings, id: 2, form_id: form.id, answer_settings: } let(:answer_settings) { { only_one_option: "true", selection_options: } } - let(:selection_options) { [{ name: "Option 1" }, { name: "Option 2" }] } + let(:selection_options) { [ { name: "Option 1" }, { name: "Option 2" } ] } before do allow(PageRepository).to receive(:find).with(page_id: "2", form_id: 1).and_return(page) @@ -162,7 +162,7 @@ end it "saves the updated answer settings to DB" do - new_settings = { only_one_option: "true", selection_options: [{ name: "Option 1" }, { name: "New option 2" }] } + new_settings = { only_one_option: "true", selection_options: [ { name: "Option 1" }, { name: "New option 2" } ] } settings_form = assigns(:bulk_options_input) draft_question_settings = settings_form.draft_question.answer_settings diff --git a/spec/requests/pages/selection/options_controller_spec.rb b/spec/requests/pages/selection/options_controller_spec.rb index c20aa5459..6e45179ed 100644 --- a/spec/requests/pages/selection/options_controller_spec.rb +++ b/spec/requests/pages/selection/options_controller_spec.rb @@ -12,7 +12,7 @@ user: standard_user, form_id: form.id, is_optional: false, - answer_settings: { selection_options: [{ name: "" }, { name: "" }], + answer_settings: { selection_options: [ { name: "" }, { name: "" } ], only_one_option: false } end let(:page_id) { nil } @@ -60,7 +60,7 @@ user: standard_user, form_id: form.id, is_optional: true, - answer_settings: { selection_options: [{ name: "Option 1" }, { name: "Option 2" }], + answer_settings: { selection_options: [ { name: "Option 1" }, { name: "Option 2" } ], only_one_option: false } end @@ -94,7 +94,7 @@ selection_options_input = assigns(:selection_options_input) draft_question_settings = selection_options_input.draft_question.answer_settings - expect(draft_question_settings).to include(selection_options: [{ name: "Option 1" }, { name: "Option 2" }]) + expect(draft_question_settings).to include(selection_options: [ { name: "Option 1" }, { name: "Option 2" } ]) end it "does not overwrite the only_one_option setting on the draft question" do @@ -191,7 +191,7 @@ selection_options_input = assigns(:selection_options_input) draft_question_settings = selection_options_input.draft_question.answer_settings - expect(draft_question_settings).to include(selection_options: [{ name: "Option 1" }, { name: "Option 2" }]) + expect(draft_question_settings).to include(selection_options: [ { name: "Option 1" }, { name: "Option 2" } ]) end it "does not overwrite the only_one_option setting on the draft question" do diff --git a/spec/requests/pages/selection/type_controller_spec.rb b/spec/requests/pages/selection/type_controller_spec.rb index 296e65ef8..d633a56c7 100644 --- a/spec/requests/pages/selection/type_controller_spec.rb +++ b/spec/requests/pages/selection/type_controller_spec.rb @@ -7,7 +7,7 @@ let(:only_one_option) { "true" } let(:answer_settings) do - { selection_options: [{ name: "" }, { name: "" }], + { selection_options: [ { name: "" }, { name: "" } ], only_one_option: } end let(:draft_question) do diff --git a/spec/requests/pages/type_of_answer_controller_spec.rb b/spec/requests/pages/type_of_answer_controller_spec.rb index be950c0e3..987dd5b70 100644 --- a/spec/requests/pages/type_of_answer_controller_spec.rb +++ b/spec/requests/pages/type_of_answer_controller_spec.rb @@ -76,8 +76,8 @@ it "saves the answer type & answer settings to draft question" do form = assigns(:type_of_answer_input) expect(form.draft_question.answer_type).to eq(type_of_answer_input.answer_type) - expect(form.draft_question.answer_settings).to eq(selection_options: [{ name: "" }, - { name: "" }]) + expect(form.draft_question.answer_settings).to eq(selection_options: [ { name: "" }, + { name: "" } ]) end it "redirects the user to the question text page" do diff --git a/spec/requests/pages_controller_spec.rb b/spec/requests/pages_controller_spec.rb index 87d9a0b80..0534d8536 100644 --- a/spec/requests/pages_controller_spec.rb +++ b/spec/requests/pages_controller_spec.rb @@ -13,9 +13,9 @@ describe "#index" do let(:pages) do - [build(:page, id: 99), + [ build(:page, id: 99), build(:page, id: 100), - build(:page, id: 101)] + build(:page, id: 101) ] end let(:form) do build(:form, id: 2, pages:) @@ -90,7 +90,7 @@ ) end - let(:pages) { [page] } + let(:pages) { [ page ] } before do allow(FormRepository).to receive_messages(find: form_response, pages: pages) @@ -137,7 +137,7 @@ id: 1, form_id: 2, question_text: "What is your favourite colour?", - selection_options: [{ name: "Red" }, { name: "Green" }, { name: "Blue" }], + selection_options: [ { name: "Red" }, { name: "Green" }, { name: "Blue" } ], only_one_option: true, routing_conditions: [ build(:condition, routing_page_id: 1, check_page_id: 1, value: "red", skip_to_end: true), @@ -166,7 +166,7 @@ form_id: 2, position: 1, question_text: "What is your favourite colour?", - selection_options: [{ name: "Red" }, { name: "Green" }, { name: "Blue" }], + selection_options: [ { name: "Red" }, { name: "Green" }, { name: "Blue" } ], only_one_option: true, routing_conditions: [ build(:condition, routing_page_id: 1, check_page_id: 1, value: "green", goto_page_id: 3), @@ -203,7 +203,7 @@ form_id: 2, position: 1, question_text: "What is your favourite colour?", - selection_options: [{ name: "Red" }, { name: "Green" }, { name: "Blue" }], + selection_options: [ { name: "Red" }, { name: "Green" }, { name: "Blue" } ], only_one_option: true, routing_conditions: [ build(:condition, routing_page_id: 1, check_page_id: 1, value: "green", goto_page_id: 3), @@ -243,7 +243,7 @@ form_id: 2, position: 1, question_text: "What is your favourite colour?", - selection_options: [{ name: "Red" }, { name: "Green" }, { name: "Blue" }], + selection_options: [ { name: "Red" }, { name: "Green" }, { name: "Blue" } ], only_one_option: true, routing_conditions: [ build(:condition, routing_page_id: 1, check_page_id: 1, value: "green", goto_page_id: 3), @@ -296,7 +296,7 @@ end let(:form_pages_response) do - [page].to_json + [ page ].to_json end before do @@ -332,9 +332,9 @@ describe "#move_page" do let(:pages) do - [build(:page, id: 99), + [ build(:page, id: 99), build(:page, id: 100), - build(:page, id: 101)] + build(:page, id: 101) ] end let(:form) do build(:form, id: 2, pages:) diff --git a/spec/requests/reports_controller_spec.rb b/spec/requests/reports_controller_spec.rb index 40bde1dd9..bff72ccd3 100644 --- a/spec/requests/reports_controller_spec.rb +++ b/spec/requests/reports_controller_spec.rb @@ -28,7 +28,7 @@ live_forms_with_routing: 2, live_forms_with_add_another_answer: 3, live_forms_with_csv_submission_enabled: 2, - all_forms_with_add_another_answer: [{ form_id: 3, name: "form name", state: "Draft", repeatable_pages: [{ page_id: 5, question_text: }] }] } + all_forms_with_add_another_answer: [ { form_id: 3, name: "form name", state: "Draft", repeatable_pages: [ { page_id: 5, question_text: } ] } ] } end before do diff --git a/spec/requests/users_controller_spec.rb b/spec/requests/users_controller_spec.rb index 3ba6b30ce..a79c8912a 100644 --- a/spec/requests/users_controller_spec.rb +++ b/spec/requests/users_controller_spec.rb @@ -182,8 +182,8 @@ end [ - ["with an unknown organisation", :with_unknown_org], - ["with no organisation set", :with_no_org], + [ "with an unknown organisation", :with_unknown_org ], + [ "with no organisation set", :with_no_org ], ].each do |(title, trait)| context "with a user #{title}" do let(:user) { create(:user, trait) } diff --git a/spec/resources/api/v1/condition_resource_spec.rb b/spec/resources/api/v1/condition_resource_spec.rb index 55b243808..bb5f6749b 100644 --- a/spec/resources/api/v1/condition_resource_spec.rb +++ b/spec/resources/api/v1/condition_resource_spec.rb @@ -6,18 +6,18 @@ describe "#errors_with_fields" do context "when the error is a known error" do - let(:validation_errors) { [OpenStruct.new(name: "answer_value_doesnt_exist"), OpenStruct.new(name: "goto_page_doesnt_exist"), OpenStruct.new(name: "cannot_have_goto_page_before_routing_page"), OpenStruct.new(name: "cannot_route_to_next_page")] } + let(:validation_errors) { [ OpenStruct.new(name: "answer_value_doesnt_exist"), OpenStruct.new(name: "goto_page_doesnt_exist"), OpenStruct.new(name: "cannot_have_goto_page_before_routing_page"), OpenStruct.new(name: "cannot_route_to_next_page") ] } it "returns the correct values for each error type" do - expect(condition.errors_with_fields).to eq [{ field: :answer_value, name: "answer_value_doesnt_exist" }, { field: :goto_page_id, name: "goto_page_doesnt_exist" }, { field: :goto_page_id, name: "cannot_have_goto_page_before_routing_page" }, { field: :goto_page_id, name: "cannot_route_to_next_page" }] + expect(condition.errors_with_fields).to eq [ { field: :answer_value, name: "answer_value_doesnt_exist" }, { field: :goto_page_id, name: "goto_page_doesnt_exist" }, { field: :goto_page_id, name: "cannot_have_goto_page_before_routing_page" }, { field: :goto_page_id, name: "cannot_route_to_next_page" } ] end end context "when the error is an unknown error" do - let(:validation_errors) { [OpenStruct.new(name: "some_unknown_error")] } + let(:validation_errors) { [ OpenStruct.new(name: "some_unknown_error") ] } it "returns answer_value as a default" do - expect(condition.errors_with_fields).to eq [{ field: :answer_value, name: "some_unknown_error" }] + expect(condition.errors_with_fields).to eq [ { field: :answer_value, name: "some_unknown_error" } ] end end end diff --git a/spec/resources/api/v1/form_resource_spec.rb b/spec/resources/api/v1/form_resource_spec.rb index b6b76bd91..26d9a879b 100644 --- a/spec/resources/api/v1/form_resource_spec.rb +++ b/spec/resources/api/v1/form_resource_spec.rb @@ -146,7 +146,7 @@ end let(:selection_pages_with_routes) do (4..5).map do |index| - build :page, :with_selection_settings, id: index, position: index, routing_conditions: [(build :condition, id: index, check_page_id: index, goto_page_id: index + 2)] + build :page, :with_selection_settings, id: index, position: index, routing_conditions: [ (build :condition, id: index, check_page_id: index, goto_page_id: index + 2) ] end end let(:selection_pages_without_routes) do @@ -175,7 +175,7 @@ let(:selection_pages_with_routes) do (4..5).map do |index| - build :page, :with_selection_settings, id: index, position: index, routing_conditions: [(build :condition, id: index, check_page_id: index, goto_page_id: index + 2)] + build :page, :with_selection_settings, id: index, position: index, routing_conditions: [ (build :condition, id: index, check_page_id: index, goto_page_id: index + 2) ] end end @@ -187,13 +187,13 @@ let(:selection_pages_with_secondary_skips) do (10..12).map do |index| - build :page, :with_selection_settings, id: index, position: index, routing_conditions: [(build :condition, id: index, check_page_id: index, goto_page_id: index + 2)] + build :page, :with_selection_settings, id: index, position: index, routing_conditions: [ (build :condition, id: index, check_page_id: index, goto_page_id: index + 2) ] end end let!(:secondary_skip_pages) do (13..16).map do |index| - build :page, :with_simple_answer_type, id: index, position: index, routing_conditions: [(build :condition, id: index, routing_page_id: index, check_page_id: index - 3, goto_page_id: index + 2)] + build :page, :with_simple_answer_type, id: index, position: index, routing_conditions: [ (build :condition, id: index, routing_page_id: index, check_page_id: index - 3, goto_page_id: index + 2) ] end end @@ -214,7 +214,7 @@ describe "#has_no_remaining_routes_available?" do let(:selection_pages_with_routes) do (1..3).map do |index| - build :page, :with_selection_settings, id: index, position: index, routing_conditions: [(build :condition, id: index, check_page_id: index, goto_page_id: index + 2)] + build :page, :with_selection_settings, id: index, position: index, routing_conditions: [ (build :condition, id: index, check_page_id: index, goto_page_id: index + 2) ] end end let(:selection_pages_without_routes) do diff --git a/spec/resources/api/v1/page_resource_spec.rb b/spec/resources/api/v1/page_resource_spec.rb index b5dd45e68..ce801be97 100644 --- a/spec/resources/api/v1/page_resource_spec.rb +++ b/spec/resources/api/v1/page_resource_spec.rb @@ -34,7 +34,7 @@ end describe "#question_text" do - [nil, ""].each do |question_text| + [ nil, "" ].each do |question_text| it "is invalid given {question_text} question text" do error_message = I18n.t("activemodel.errors.models.api/v1/page_resource.attributes.question_text.blank") page.question_text = question_text diff --git a/spec/services/cloud_watch_service_spec.rb b/spec/services/cloud_watch_service_spec.rb index e6664cca4..c6180b2bf 100644 --- a/spec/services/cloud_watch_service_spec.rb +++ b/spec/services/cloud_watch_service_spec.rb @@ -15,7 +15,7 @@ end describe "#week_submissions" do - let(:datapoints) { [{ sum: total_submissions }] } + let(:datapoints) { [ { sum: total_submissions } ] } let(:total_submissions) { 3.0 } it "calls the cloudwatch client with get_metric_statistics" do @@ -85,7 +85,7 @@ end describe "#week_starts" do - let(:datapoints) { [{ sum: total_starts }] } + let(:datapoints) { [ { sum: total_starts } ] } let(:total_starts) { 5.0 } it "calls the cloudwatch client with get_metric_statistics" do diff --git a/spec/services/default_group_service_spec.rb b/spec/services/default_group_service_spec.rb index fbc8f2dba..f220637ea 100644 --- a/spec/services/default_group_service_spec.rb +++ b/spec/services/default_group_service_spec.rb @@ -9,7 +9,7 @@ let(:user) { create :user, name: "Batman" } let(:form) { build :form, id: 1 } let(:forms_response) do - [form] + [ form ] end before do @@ -28,8 +28,8 @@ organisation: user.organisation, ) expect(Group.last).to be_trial - expect(Group.last.users).to eq [user] - expect(Group.last.users.group_admins).to eq [user] + expect(Group.last.users).to eq [ user ] + expect(Group.last.users.group_admins).to eq [ user ] end it "adds their trial forms to the group" do @@ -113,7 +113,7 @@ before do another_user = create :user, name: "Batman", email: "batsignal@example.gov.uk", organisation: user.organisation - allow(FormRepository).to receive(:where).with(creator_id: another_user.id).and_return([build(:form, id: 10)]) + allow(FormRepository).to receive(:where).with(creator_id: another_user.id).and_return([ build(:form, id: 10) ]) default_group_service.create_user_default_trial_group!(another_user) end @@ -133,7 +133,7 @@ before do yet_another_user = create :user, name: "Batman", email: "batman@joker.example.com", organisation: user.organisation - allow(FormRepository).to receive(:where).with(creator_id: yet_another_user.id).and_return([build(:form, id: 100)]) + allow(FormRepository).to receive(:where).with(creator_id: yet_another_user.id).and_return([ build(:form, id: 100) ]) default_group_service.create_user_default_trial_group!(yet_another_user) end diff --git a/spec/services/form_repository_spec.rb b/spec/services/form_repository_spec.rb index 7d2daea4c..d72a1c8e0 100644 --- a/spec/services/form_repository_spec.rb +++ b/spec/services/form_repository_spec.rb @@ -68,12 +68,12 @@ before do ActiveResource::HttpMock.respond_to do |mock| - mock.get "/api/v1/forms?creator_id=3", headers, [form].to_json, 200 + mock.get "/api/v1/forms?creator_id=3", headers, [ form ].to_json, 200 end end it "calls the where endpoint through ActiveResource" do - where_request = ActiveResource::Request.new(:get, "/api/v1/forms?creator_id=3", [form], headers) + where_request = ActiveResource::Request.new(:get, "/api/v1/forms?creator_id=3", [ form ], headers) described_class.where(creator_id: 3) expect(ActiveResource::HttpMock.requests).to include where_request end diff --git a/spec/services/form_task_list_service_spec.rb b/spec/services/form_task_list_service_spec.rb index b07880481..adfbcde54 100644 --- a/spec/services/form_task_list_service_spec.rb +++ b/spec/services/form_task_list_service_spec.rb @@ -87,7 +87,7 @@ end it "returns 5 sections" do - expected_sections = [{ title: "Task 1" }, { title: "Task 2" }, { title: "Task 3" }, { title: "Task 4" }, { title: "Task 5" }, { title: "Task 6" }] + expected_sections = [ { title: "Task 1" }, { title: "Task 2" }, { title: "Task 3" }, { title: "Task 4" }, { title: "Task 5" }, { title: "Task 6" } ] expect(all_sections.count).to eq expected_sections.count end @@ -109,7 +109,7 @@ end context "when a page already exists" do - let(:pages) { [build(:page)] } + let(:pages) { [ build(:page) ] } it "has a link to add/edit existing pages (if pages/questions exist)" do expect(section_rows[1][:task_name]).to eq "Add and edit your questions" @@ -383,7 +383,7 @@ end context "when the form has at least one page" do - let(:pages) { [build(:page)] } + let(:pages) { [ build(:page) ] } it "has the correct task name" do expect(section_rows.first[:task_name]).to eq(I18n.t("forms.task_list_create.make_form_live_section.share_preview")) diff --git a/spec/services/page_options_service_spec.rb b/spec/services/page_options_service_spec.rb index 41851bde0..12781493c 100644 --- a/spec/services/page_options_service_spec.rb +++ b/spec/services/page_options_service_spec.rb @@ -6,7 +6,7 @@ end let(:pages) do - [page, (build :page, id: 2), (build :page, id: 3), (build :page, id: 4)] + [ page, (build :page, id: 2), (build :page, id: 3), (build :page, id: 4) ] end describe "#all_options_for_answer_type" do @@ -15,8 +15,8 @@ it "returns the correct options" do expect(page_options_service.all_options_for_answer_type).to eq( - [{ key: { text: I18n.t("helpers.label.page.answer_type_options.title") }, - value: { text: I18n.t("helpers.label.page.address_settings_options.names.uk_and_international_addresses") } }], + [ { key: { text: I18n.t("helpers.label.page.answer_type_options.title") }, + value: { text: I18n.t("helpers.label.page.address_settings_options.names.uk_and_international_addresses") } } ], ) end end @@ -26,8 +26,8 @@ it "returns the correct options" do expect(page_options_service.all_options_for_answer_type).to eq( - [{ key: { text: I18n.t("helpers.label.page.answer_type_options.title") }, - value: { text: I18n.t("helpers.label.page.address_settings_options.names.international_addresses") } }], + [ { key: { text: I18n.t("helpers.label.page.answer_type_options.title") }, + value: { text: I18n.t("helpers.label.page.address_settings_options.names.international_addresses") } } ], ) end end @@ -37,8 +37,8 @@ it "returns the correct options" do expect(page_options_service.all_options_for_answer_type).to eq( - [{ key: { text: I18n.t("helpers.label.page.answer_type_options.title") }, - value: { text: I18n.t("helpers.label.page.address_settings_options.names.uk_addresses") } }], + [ { key: { text: I18n.t("helpers.label.page.answer_type_options.title") }, + value: { text: I18n.t("helpers.label.page.address_settings_options.names.uk_addresses") } } ], ) end end @@ -48,8 +48,8 @@ it "returns the correct options" do expect(page_options_service.all_options_for_answer_type).to eq( - [{ key: { text: I18n.t("helpers.label.page.answer_type_options.title") }, - value: { text: I18n.t("helpers.label.page.address_settings_options.names.international_addresses") } }], + [ { key: { text: I18n.t("helpers.label.page.answer_type_options.title") }, + value: { text: I18n.t("helpers.label.page.address_settings_options.names.international_addresses") } } ], ) end end @@ -104,8 +104,8 @@ is_optional: "false", answer_type: "selection", answer_settings: OpenStruct.new(only_one_option: "true", - selection_options: [OpenStruct.new(attributes: { name: "Option 1" }), - OpenStruct.new(attributes: { name: "Option 2" })]) + selection_options: [ OpenStruct.new(attributes: { name: "Option 1" }), + OpenStruct.new(attributes: { name: "Option 2" }) ]) end it "returns the correct options" do @@ -122,8 +122,8 @@ is_optional: "false", answer_type: "selection", answer_settings: OpenStruct.new(only_one_option: "false", - selection_options: [OpenStruct.new(attributes: { name: "Option 1" }), - OpenStruct.new(attributes: { name: "Option 2" })]) + selection_options: [ OpenStruct.new(attributes: { name: "Option 1" }), + OpenStruct.new(attributes: { name: "Option 2" }) ]) end it "returns the correct options" do @@ -209,7 +209,7 @@ end context "with a single condition" do - let(:routing_conditions) { [condition_pointing_to_page_3] } + let(:routing_conditions) { [ condition_pointing_to_page_3 ] } it "returns the correct options" do expect(page_options_service.all_options_for_answer_type).to include( @@ -222,7 +222,7 @@ end context "with multiple conditions" do - let(:routing_conditions) { [condition_pointing_to_page_3, condition_pointing_to_page_4] } + let(:routing_conditions) { [ condition_pointing_to_page_3, condition_pointing_to_page_4 ] } it "returns the correct options" do expect(page_options_service.all_options_for_answer_type).to include( @@ -235,7 +235,7 @@ end context "with a condition that points to the end of the form" do - let(:routing_conditions) { [condition] } + let(:routing_conditions) { [ condition ] } let(:answer_value) { "Wales" } let(:condition) { build :condition, answer_value:, goto_page_id: nil, skip_to_end: true } diff --git a/spec/services/page_summary_card_data_service_spec.rb b/spec/services/page_summary_card_data_service_spec.rb index e0f3d9510..662ede5ba 100644 --- a/spec/services/page_summary_card_data_service_spec.rb +++ b/spec/services/page_summary_card_data_service_spec.rb @@ -11,7 +11,7 @@ describe "#build_data" do before do - allow(PageOptionsService).to receive(:call).and_return(OpenStruct.new(all_options_for_answer_type: [1, 2])) + allow(PageOptionsService).to receive(:call).and_return(OpenStruct.new(all_options_for_answer_type: [ 1, 2 ])) end it "includes a title" do @@ -19,7 +19,7 @@ end it "includes an array of rows" do - expect(service.build_data[:rows]).to eq [1, 2] + expect(service.build_data[:rows]).to eq [ 1, 2 ] end context "when the page is a selection question" do diff --git a/spec/services/reports/users_report_service_spec.rb b/spec/services/reports/users_report_service_spec.rb index 436d7c5fc..319f9efdb 100644 --- a/spec/services/reports/users_report_service_spec.rb +++ b/spec/services/reports/users_report_service_spec.rb @@ -28,9 +28,9 @@ create :user, organisation: org2 create :user, :with_no_org expect(users_report_service.user_data[:rows]).to eq([ - [{ text: org1.name }, { text: 2, numeric: true }], - [{ text: org2.name }, { text: 1, numeric: true }], - [{ text: I18n.t("users.index.organisation_blank") }, { text: 1, numeric: true }], + [ { text: org1.name }, { text: 2, numeric: true } ], + [ { text: org2.name }, { text: 1, numeric: true } ], + [ { text: I18n.t("users.index.organisation_blank") }, { text: 1, numeric: true } ], ]) end end diff --git a/spec/support/shared_context/pages_with_routing.rb b/spec/support/shared_context/pages_with_routing.rb index 362130e85..9e11716a1 100644 --- a/spec/support/shared_context/pages_with_routing.rb +++ b/spec/support/shared_context/pages_with_routing.rb @@ -15,7 +15,7 @@ position: 2, next_page: 3, question_text: "Branch question (start of a route)", - selection_options: [{ name: "First branch" }, { name: "Second branch" }], + selection_options: [ { name: "First branch" }, { name: "Second branch" } ], routing_conditions: [ build( :condition, @@ -93,7 +93,7 @@ position: 10, next_page: 11, question_text: "Skip question", - selection_options: [{ name: "Skip" }, { name: "Don't skip" }], + selection_options: [ { name: "Skip" }, { name: "Don't skip" } ], routing_conditions: [ build( :condition, diff --git a/spec/views/group_members/index.html.erb_spec.rb b/spec/views/group_members/index.html.erb_spec.rb index cbd95ee4a..89d032a25 100644 --- a/spec/views/group_members/index.html.erb_spec.rb +++ b/spec/views/group_members/index.html.erb_spec.rb @@ -5,7 +5,7 @@ let(:current_user) { create(:user, organisation:) } let(:first_user_in_table) { build(:user, organisation:) } let(:second_user_in_table) { build(:user, organisation:) } - let(:memberships) { [create(:membership, user: first_user_in_table, role: :editor, group:), create(:membership, user: second_user_in_table, role: :group_admin, group:)] } + let(:memberships) { [ create(:membership, user: first_user_in_table, role: :editor, group:), create(:membership, user: second_user_in_table, role: :group_admin, group:) ] } let(:group) { create(:group, name: "Group 1", organisation:) } let(:can_add_editor) { true } let(:can_add_group_member) { false } @@ -56,7 +56,7 @@ let(:second_user_in_table) { build :user, organisation:, name: "Alice Square" } it "sorts the group memberships by user name" do - expect(rendered).to have_table(with_cols: [["Alice Square", "Bob Blob"]]) + expect(rendered).to have_table(with_cols: [ [ "Alice Square", "Bob Blob" ] ]) end end diff --git a/spec/views/groups/show.html.erb_spec.rb b/spec/views/groups/show.html.erb_spec.rb index 68b300966..c118292a3 100644 --- a/spec/views/groups/show.html.erb_spec.rb +++ b/spec/views/groups/show.html.erb_spec.rb @@ -105,9 +105,9 @@ end expect(status_tags).to eq [ - [{ text: "Draft", colour: "yellow" }], - [{ text: "Live", colour: "turquoise" }], - [{ text: "Draft", colour: "yellow" }, { text: "Live", colour: "turquoise" }], + [ { text: "Draft", colour: "yellow" } ], + [ { text: "Live", colour: "turquoise" } ], + [ { text: "Draft", colour: "yellow" }, { text: "Live", colour: "turquoise" } ], ] end end diff --git a/spec/views/pages/conditions/edit.html.erb_spec.rb b/spec/views/pages/conditions/edit.html.erb_spec.rb index 5a6917cf4..741bf3935 100644 --- a/spec/views/pages/conditions/edit.html.erb_spec.rb +++ b/spec/views/pages/conditions/edit.html.erb_spec.rb @@ -11,8 +11,8 @@ is_optional: "false", answer_type: "selection", answer_settings: OpenStruct.new(only_one_option: "true", - selection_options: [OpenStruct.new(attributes: { name: "Option 1" }), - OpenStruct.new(attributes: { name: "Option 2" })]) + selection_options: [ OpenStruct.new(attributes: { name: "Option 1" }), + OpenStruct.new(attributes: { name: "Option 2" }) ]) end before do diff --git a/spec/views/pages/conditions/new.html.erb_spec.rb b/spec/views/pages/conditions/new.html.erb_spec.rb index 6a12cdaf8..989ed7cf0 100644 --- a/spec/views/pages/conditions/new.html.erb_spec.rb +++ b/spec/views/pages/conditions/new.html.erb_spec.rb @@ -4,8 +4,8 @@ let(:form) { build :form, id: 1 } let(:pages) do build_list :page, 3, answer_settings: OpenStruct.new(only_one_option: "true", - selection_options: [OpenStruct.new(attributes: { name: "Option 1" }), - OpenStruct.new(attributes: { name: "Option 2" })]), form_id: 1 + selection_options: [ OpenStruct.new(attributes: { name: "Option 1" }), + OpenStruct.new(attributes: { name: "Option 2" }) ]), form_id: 1 end let(:condition_input) { Pages::ConditionsInput.new(form:, page: pages.first) } diff --git a/spec/views/pages/edit.html.erb_spec.rb b/spec/views/pages/edit.html.erb_spec.rb index e8891f5ce..cd74071fc 100644 --- a/spec/views/pages/edit.html.erb_spec.rb +++ b/spec/views/pages/edit.html.erb_spec.rb @@ -3,7 +3,7 @@ describe "pages/edit.html.erb" do let(:question_text) { nil } - let(:form) { build :form, id: 1, pages: [page] } + let(:form) { build :form, id: 1, pages: [ page ] } let(:group) { create :group } let(:page) { build :page, id: 1, question_text:, form_id: 1, answer_type:, answer_settings: {}, page_heading: nil } let(:answer_type) { "email" } diff --git a/spec/views/pages/index.html.erb_spec.rb b/spec/views/pages/index.html.erb_spec.rb index 216205479..bec0e0819 100644 --- a/spec/views/pages/index.html.erb_spec.rb +++ b/spec/views/pages/index.html.erb_spec.rb @@ -42,7 +42,7 @@ end describe "when there are one or more page to display" do - let(:pages) { [(build :page, id: 1, position: 1, form_id: 1), (build :page, id: 2, position: 2, form_id: 1), (build :page, id: 3, position: 3, form_id: 1)] } + let(:pages) { [ (build :page, id: 1, position: 1, form_id: 1), (build :page, id: 2, position: 2, form_id: 1), (build :page, id: 3, position: 3, form_id: 1) ] } it "allows the user to add a page" do expect(rendered).to have_link(I18n.t("pages.index.add_question"), href: start_new_question_path(form.id)) diff --git a/spec/views/pages/routes/delete.html.erb_spec.rb b/spec/views/pages/routes/delete.html.erb_spec.rb index aeb1a0193..3150c9fa4 100644 --- a/spec/views/pages/routes/delete.html.erb_spec.rb +++ b/spec/views/pages/routes/delete.html.erb_spec.rb @@ -1,7 +1,7 @@ require "rails_helper" describe "pages/routes/delete.html.erb" do - let(:form) { build :form, id: 1, pages: [page] } + let(:form) { build :form, id: 1, pages: [ page ] } let(:page) { build :page, id: 1, position: 1 } before do diff --git a/spec/views/pages/routes/show.html.erb_spec.rb b/spec/views/pages/routes/show.html.erb_spec.rb index 4eff0c6dd..6cf95a9b8 100644 --- a/spec/views/pages/routes/show.html.erb_spec.rb +++ b/spec/views/pages/routes/show.html.erb_spec.rb @@ -1,9 +1,9 @@ require "rails_helper" describe "pages/routes/show.html.erb" do - let(:form) { build :form, id: 1, pages: [page] } - let(:pages) { [page, next_page] } - let(:page) { build :page, id: 1, position: 1, next_page: 2, routing_conditions: [build(:condition)] } + let(:form) { build :form, id: 1, pages: [ page ] } + let(:pages) { [ page, next_page ] } + let(:page) { build :page, id: 1, position: 1, next_page: 2, routing_conditions: [ build(:condition) ] } let(:next_page) { build :page, id: 2 } let(:routes) { PageRoutesService.new(form:, pages:, page:).routes } diff --git a/spec/views/pages/secondary_skip/new.html.erb_spec.rb b/spec/views/pages/secondary_skip/new.html.erb_spec.rb index 5fab99ca1..adc9db5a6 100644 --- a/spec/views/pages/secondary_skip/new.html.erb_spec.rb +++ b/spec/views/pages/secondary_skip/new.html.erb_spec.rb @@ -1,7 +1,7 @@ require "rails_helper" describe "pages/secondary_skip/new.html.erb" do - let(:form) { build :form, id: 1, pages: [page] } + let(:form) { build :form, id: 1, pages: [ page ] } let(:page) do build(:page, :with_selection_settings, diff --git a/spec/views/pages/selection/bulk_options.html.erb_spec.rb b/spec/views/pages/selection/bulk_options.html.erb_spec.rb index 87f1aae65..df14c9b66 100644 --- a/spec/views/pages/selection/bulk_options.html.erb_spec.rb +++ b/spec/views/pages/selection/bulk_options.html.erb_spec.rb @@ -1,7 +1,7 @@ require "rails_helper" describe "pages/selection/bulk_options.html.erb", type: :view do - let(:form) { build :form, id: 1, pages: [page] } + let(:form) { build :form, id: 1, pages: [ page ] } let(:bulk_options_input) { build :bulk_options_input, draft_question: page } let(:page) { OpenStruct.new(answer_type: "selection", answer_settings:) } let(:answer_settings) { OpenStruct.new(only_one_option:, selection_options:) } diff --git a/spec/views/pages/selection/options.html.erb_spec.rb b/spec/views/pages/selection/options.html.erb_spec.rb index cabd8b491..3363b686c 100644 --- a/spec/views/pages/selection/options.html.erb_spec.rb +++ b/spec/views/pages/selection/options.html.erb_spec.rb @@ -7,7 +7,7 @@ let(:back_link_url) { "/a-back-link-url" } let(:bulk_options_url) { "/a-link-to-bulk-options-page" } let(:selection_options_path) { "/a-path" } - let(:selection_options) { [{ name: "France" }, { name: "Spain" }, { name: "Italy" }] } + let(:selection_options) { [ { name: "France" }, { name: "Spain" }, { name: "Italy" } ] } let(:include_none_of_the_above) { "true" } let(:only_one_option) { "true" } let(:draft_question) { build :draft_question, answer_type: "selection", answer_settings: { only_one_option: } } diff --git a/spec/views/pages/selection/type.html.erb_spec.rb b/spec/views/pages/selection/type.html.erb_spec.rb index 4034d38dc..203903a30 100644 --- a/spec/views/pages/selection/type.html.erb_spec.rb +++ b/spec/views/pages/selection/type.html.erb_spec.rb @@ -70,7 +70,7 @@ end context "when editing an existing question" do - let(:form) { build :form, id: 1, pages: [page] } + let(:form) { build :form, id: 1, pages: [ page ] } context "when no routing conditions set" do it "does not display a warning about routes being deleted" do @@ -80,7 +80,7 @@ end context "when a routing condition is set" do - let(:routing_conditions) { [(build :condition)] } + let(:routing_conditions) { [ (build :condition) ] } context "when the options will not need to be reduced" do before do diff --git a/spec/views/pages/type_of_answer.html.erb_spec.rb b/spec/views/pages/type_of_answer.html.erb_spec.rb index ba8539c6b..582d5c713 100644 --- a/spec/views/pages/type_of_answer.html.erb_spec.rb +++ b/spec/views/pages/type_of_answer.html.erb_spec.rb @@ -71,7 +71,7 @@ context "when editing an existing" do let(:page) { OpenStruct.new(routing_conditions:, answer_type:) } let(:answer_type) { "selection" } - let(:routing_conditions) { [(build :condition)] } + let(:routing_conditions) { [ (build :condition) ] } it "displays a warning about routes being deleted if answer type changes" do expect(Capybara.string(rendered.html).find(".govuk-notification-banner__content").text(normalize_ws: true)) diff --git a/spec/views/reports/add_another_answer.html.erb_spec.rb b/spec/views/reports/add_another_answer.html.erb_spec.rb index 04e855c07..e53bf37b2 100644 --- a/spec/views/reports/add_another_answer.html.erb_spec.rb +++ b/spec/views/reports/add_another_answer.html.erb_spec.rb @@ -6,7 +6,7 @@ let(:question_text) { "Question text" } let(:state) { "live_with_draft" } let(:report) do - Report.new({ all_forms_with_add_another_answer: [{ form_id:, name:, state:, repeatable_pages: [{ page_id: 5, question_text: }] }] }) + Report.new({ all_forms_with_add_another_answer: [ { form_id:, name:, state:, repeatable_pages: [ { page_id: 5, question_text: } ] } ] }) end before do diff --git a/spec/views/reports/users.html.erb_spec.rb b/spec/views/reports/users.html.erb_spec.rb index 7429c7d1b..8aa618166 100644 --- a/spec/views/reports/users.html.erb_spec.rb +++ b/spec/views/reports/users.html.erb_spec.rb @@ -9,8 +9,8 @@ { text: "user count", numeric: true }, ], rows: [ - [{ text: "org 1" }, { text: 2, numeric: true }], - [{ text: "org 2" }, { text: 1, numeric: true }], + [ { text: "org 1" }, { text: 2, numeric: true } ], + [ { text: "org 2" }, { text: 1, numeric: true } ], ], } end @@ -34,6 +34,6 @@ end it "contains the table" do - expect(rendered).to have_table(with_rows: [["org 1", "2"], ["org 2", "1"]]) + expect(rendered).to have_table(with_rows: [ [ "org 1", "2" ], [ "org 2", "1" ] ]) end end diff --git a/spec/views/users/edit.html.erb_spec.rb b/spec/views/users/edit.html.erb_spec.rb index b9cace521..0f5f84a86 100644 --- a/spec/views/users/edit.html.erb_spec.rb +++ b/spec/views/users/edit.html.erb_spec.rb @@ -151,7 +151,7 @@ end it "prompts super admin to choose organisation" do - expect(rendered).to have_select("Organisation", with_options: ["Select an organisation"]) + expect(rendered).to have_select("Organisation", with_options: [ "Select an organisation" ]) end end @@ -163,7 +163,7 @@ end it "prompts super admin to choose organisation" do - expect(rendered).to have_select("Organisation", with_options: ["Select an organisation"]) + expect(rendered).to have_select("Organisation", with_options: [ "Select an organisation" ]) end end diff --git a/spec/views/users/index.html.erb_spec.rb b/spec/views/users/index.html.erb_spec.rb index a03fef05d..36b5973d0 100644 --- a/spec/views/users/index.html.erb_spec.rb +++ b/spec/views/users/index.html.erb_spec.rb @@ -39,7 +39,7 @@ end context "with a user with no name set" do - let(:users) { [build(:user, :with_no_name, id: 1)] } + let(:users) { [ build(:user, :with_no_name, id: 1) ] } it "shows no name set" do expect(rendered).to have_text("No name set") @@ -47,7 +47,7 @@ end context "with a user with an unknown organisation" do - let(:users) { [build(:user, :with_unknown_org, id: 1)] } + let(:users) { [ build(:user, :with_unknown_org, id: 1) ] } it "shows no organisation set" do expect(rendered).to have_text("No organisation set") @@ -55,7 +55,7 @@ end context "with a user with no organisation set" do - let(:users) { [build(:user, :with_no_org, id: 1)] } + let(:users) { [ build(:user, :with_no_org, id: 1) ] } it "shows no organisation set" do expect(rendered).to have_text("No organisation set")