Browse Source

Ruby 3.1 syntax rubocop

pull/302/head
baarkerlounger 3 years ago
parent
commit
49f27e6ccc
  1. 2
      app/controllers/form_controller.rb
  2. 4
      app/mailers/devise_notify_mailer.rb
  3. 12
      app/models/validations/household_validations.rb
  4. 4
      app/models/validations/soft_validations.rb
  5. 2
      app/services/imports/user_import_service.rb
  6. 4
      app/services/sms.rb
  7. 2
      app/services/storage_service.rb
  8. 4
      spec/components/tab_navigation_component_spec.rb
  9. 4
      spec/controllers/admin/admin_users_controller_spec.rb
  10. 4
      spec/controllers/admin/case_logs_controller_spec.rb
  11. 4
      spec/controllers/admin/organisations_controller_spec.rb
  12. 4
      spec/controllers/admin/users_controller_spec.rb
  13. 4
      spec/helpers/tab_nav_helper_spec.rb
  14. 228
      spec/models/case_log_spec.rb
  15. 2
      spec/requests/auth/passwords_controller_spec.rb
  16. 2
      spec/requests/form_controller_spec.rb
  17. 4
      spec/requests/users_controller_spec.rb
  18. 2
      spec/services/storage_service_spec.rb

2
app/controllers/form_controller.rb

@ -27,7 +27,7 @@ class FormController < ApplicationController
if @case_log
current_url = request.env["PATH_INFO"]
subsection = @case_log.form.get_subsection(current_url.split("/")[-2])
render "form/check_answers", locals: { subsection: subsection }
render "form/check_answers", locals: { subsection: }
else
render_not_found
end

4
app/mailers/devise_notify_mailer.rb

@ -15,8 +15,8 @@ class DeviseNotifyMailer < Devise::Mailer
def send_email(email, template_id, personalisation)
notify_client.send_email(
email_address: email,
template_id: template_id,
personalisation: personalisation,
template_id:,
personalisation:,
)
end

12
app/models/validations/household_validations.rb

@ -94,11 +94,11 @@ private
begin
Integer(record.public_send("age#{person_num}_before_type_cast"))
rescue ArgumentError
record.errors.add "age#{person_num}".to_sym, I18n.t("validations.household.age.must_be_valid", lower_bound: lower_bound)
record.errors.add "age#{person_num}".to_sym, I18n.t("validations.household.age.must_be_valid", lower_bound:)
end
if age < lower_bound || age > 120
record.errors.add "age#{person_num}".to_sym, I18n.t("validations.household.age.must_be_valid", lower_bound: lower_bound)
record.errors.add "age#{person_num}".to_sym, I18n.t("validations.household.age.must_be_valid", lower_bound:)
end
end
@ -108,10 +108,10 @@ private
return unless age && economic_status
if age > 70 && economic_status != "Retired"
record.errors.add "ecstat#{person_num}", I18n.t("validations.household.ecstat.retired_over_70", person_num: person_num)
record.errors.add "ecstat#{person_num}", I18n.t("validations.household.ecstat.retired_over_70", person_num:)
end
if age < 16 && economic_status != "Child under 16"
record.errors.add "ecstat#{person_num}", I18n.t("validations.household.ecstat.child_under_16", person_num: person_num)
record.errors.add "ecstat#{person_num}", I18n.t("validations.household.ecstat.child_under_16", person_num:)
end
end
@ -121,7 +121,7 @@ private
return unless age && relationship
if age < 16 && relationship != "Child - includes young adult and grown-up"
record.errors.add "relat#{person_num}", I18n.t("validations.household.relat.child_under_16", person_num: person_num)
record.errors.add "relat#{person_num}", I18n.t("validations.household.relat.child_under_16", person_num:)
end
end
@ -132,7 +132,7 @@ private
return unless age && economic_status && relationship
if age >= 16 && age <= 19 && relationship == "Child - includes young adult and grown-up" && (economic_status != "Full-time student" || economic_status != "Prefer not to say")
record.errors.add "ecstat#{person_num}", I18n.t("validations.household.ecstat.student_16_19", person_num: person_num)
record.errors.add "ecstat#{person_num}", I18n.t("validations.household.ecstat.student_16_19", person_num:)
end
end

4
app/models/validations/soft_validations.rb

@ -18,12 +18,12 @@ private
if net_income_in_soft_min_range?
net_income_errors["override_net_income_validation"] = OpenStruct.new(
message: I18n.t("soft_validations.net_income.in_soft_min_range.message"),
hint_text: I18n.t("soft_validations.net_income.hint_text", ecstat1: ecstat1),
hint_text: I18n.t("soft_validations.net_income.hint_text", ecstat1:),
)
elsif net_income_in_soft_max_range?
net_income_errors["override_net_income_validation"] = OpenStruct.new(
message: I18n.t("soft_validations.net_income.in_soft_max_range.message"),
hint_text: I18n.t("soft_validations.net_income.hint_text", ecstat1: ecstat1),
hint_text: I18n.t("soft_validations.net_income.hint_text", ecstat1:),
)
else
update_column(:override_net_income_validation, nil)

2
app/services/imports/user_import_service.rb

@ -18,7 +18,7 @@ module Imports
password: Devise.friendly_token,
phone: user_field_value(xml_document, "telephone-no"),
old_user_id: user_field_value(xml_document, "id"),
organisation: organisation,
organisation:,
role: PROVIDER_TYPE[user_field_value(xml_document, "user-type")],
)
rescue ActiveRecord::RecordNotUnique

4
app/services/sms.rb

@ -7,8 +7,8 @@ class Sms
def self.send(phone_number, template_id, args)
notify_client.send_sms(
phone_number: phone_number,
template_id: template_id,
phone_number:,
template_id:,
personalisation: args,
)
end

2
app/services/storage_service.rb

@ -48,7 +48,7 @@ private
)
Aws::S3::Client.new(
region: @configuration.region,
credentials: credentials,
credentials:,
)
end
end

4
spec/components/tab_navigation_component_spec.rb

@ -9,7 +9,7 @@ RSpec.describe TabNavigationComponent, type: :component do
context "when the item is 'current' in nav tabs" do
it "then that tab appears as selected" do
result = render_inline(described_class.new(items: items))
result = render_inline(described_class.new(items:))
expect(result.css('.app-tab-navigation__link[aria-current="page"]').text).to include("Application")
end
@ -17,7 +17,7 @@ RSpec.describe TabNavigationComponent, type: :component do
context "when rendering tabs" do
it "all of the nav tabs specified in the items hash are passed to it" do
result = render_inline(described_class.new(items: items))
result = render_inline(described_class.new(items:))
expect(result.text).to include("Application")
expect(result.text).to include("Notes")

4
spec/controllers/admin/admin_users_controller_spec.rb

@ -32,7 +32,7 @@ describe Admin::AdminUsersController, type: :controller do
end
it "tracks who created the record" do
post :create, session: valid_session, params: params
post(:create, session: valid_session, params:)
created_id = response.location.match(/[0-9]+/)[0]
whodunnit_actor = AdminUser.find_by(id: created_id).versions.last.actor
expect(whodunnit_actor).to be_a(AdminUser)
@ -56,7 +56,7 @@ describe Admin::AdminUsersController, type: :controller do
context "when updating an admin user" do
let(:admin_user) { FactoryBot.create(:admin_user) }
let(:email) { "new_email@example.com" }
let(:params) { { id: admin_user.id, admin_user: { email: email } } }
let(:params) { { id: admin_user.id, admin_user: { email: } } }
before do
patch :update, session: valid_session, params: params

4
spec/controllers/admin/case_logs_controller_spec.rb

@ -44,7 +44,7 @@ describe Admin::CaseLogsController, type: :controller do
end
it "tracks who created the record" do
post :create, session: valid_session, params: params
post(:create, session: valid_session, params:)
created_id = response.location.match(/[0-9]+/)[0]
whodunnit_actor = CaseLog.find_by(id: created_id).versions.last.actor
expect(whodunnit_actor).to be_a(AdminUser)
@ -68,7 +68,7 @@ describe Admin::CaseLogsController, type: :controller do
context "when updating the case_log" do
let(:tenant_code) { "New tenant code by Admin" }
let(:params) { { id: case_log.id, case_log: { tenant_code: tenant_code } } }
let(:params) { { id: case_log.id, case_log: { tenant_code: } } }
before do
patch :update, session: valid_session, params: params

4
spec/controllers/admin/organisations_controller_spec.rb

@ -33,7 +33,7 @@ describe Admin::OrganisationsController, type: :controller do
end
it "tracks who created the record" do
post :create, session: valid_session, params: params
post(:create, session: valid_session, params:)
created_id = response.location.match(/[0-9]+/)[0]
whodunnit_actor = Organisation.find_by(id: created_id).versions.last.actor
expect(whodunnit_actor).to be_a(AdminUser)
@ -56,7 +56,7 @@ describe Admin::OrganisationsController, type: :controller do
context "when updating the organisation" do
let(:name) { "New Org Name by Admin" }
let(:params) { { id: organisation.id, organisation: { name: name } } }
let(:params) { { id: organisation.id, organisation: { name: } } }
before do
patch :update, session: valid_session, params: params

4
spec/controllers/admin/users_controller_spec.rb

@ -44,7 +44,7 @@ describe Admin::UsersController, type: :controller do
end
it "tracks who created the record" do
post :create, session: valid_session, params: params
post(:create, session: valid_session, params:)
created_id = response.location.match(/[0-9]+/)[0]
whodunnit_actor = User.find_by(id: created_id).versions.last.actor
expect(whodunnit_actor).to be_a(AdminUser)
@ -70,7 +70,7 @@ describe Admin::UsersController, type: :controller do
context "when updating the user" do
let(:name) { "Pete" }
let(:params) { { id: user.id, user: { name: name } } }
let(:params) { { id: user.id, user: { name: } } }
before do
patch :update, session: valid_session, params: params

4
spec/helpers/tab_nav_helper_spec.rb

@ -2,7 +2,7 @@ require "rails_helper"
RSpec.describe TabNavHelper do
let(:organisation) { FactoryBot.create(:organisation) }
let(:user) { FactoryBot.build(:user, organisation: organisation) }
let(:user) { FactoryBot.build(:user, organisation:) }
describe "#user_cell" do
it "returns user link and email separated by a newline character" do
@ -20,7 +20,7 @@ RSpec.describe TabNavHelper do
describe "#tab_items" do
context "when user is a data_coordinator" do
let(:user) { FactoryBot.build(:user, :data_coordinator, organisation: organisation) }
let(:user) { FactoryBot.build(:user, :data_coordinator, organisation:) }
it "returns details and user tabs" do
result = tab_items(user).map { |i| i[:name] }

228
spec/models/case_log_spec.rb

@ -21,8 +21,8 @@ RSpec.describe CaseLog do
context "when creating a record" do
let(:case_log) do
described_class.create(
owning_organisation: owning_organisation,
managing_organisation: managing_organisation,
owning_organisation:,
managing_organisation:,
)
end
@ -38,8 +38,8 @@ RSpec.describe CaseLog do
expect {
described_class.create!(reason: "Don’t know",
underoccupation_benefitcap: "Yes - benefit cap",
owning_organisation: owning_organisation,
managing_organisation: managing_organisation)
owning_organisation:,
managing_organisation:)
}.to raise_error(ActiveRecord::RecordInvalid)
end
end
@ -49,8 +49,8 @@ RSpec.describe CaseLog do
expect {
described_class.create!(reason: "Other",
other_reason_for_leaving_last_settled_home: nil,
owning_organisation: owning_organisation,
managing_organisation: managing_organisation)
owning_organisation:,
managing_organisation:)
}.to raise_error(ActiveRecord::RecordInvalid)
end
@ -58,8 +58,8 @@ RSpec.describe CaseLog do
expect {
described_class.create!(reason: "Repossession",
other_reason_for_leaving_last_settled_home: "the other reason provided",
owning_organisation: owning_organisation,
managing_organisation: managing_organisation)
owning_organisation:,
managing_organisation:)
}.to raise_error(ActiveRecord::RecordInvalid)
end
end
@ -69,8 +69,8 @@ RSpec.describe CaseLog do
expect {
described_class.create!(armedforces: "No",
reservist: "Yes",
owning_organisation: owning_organisation,
managing_organisation: managing_organisation)
owning_organisation:,
managing_organisation:)
}.to raise_error(ActiveRecord::RecordInvalid)
end
end
@ -82,8 +82,8 @@ RSpec.describe CaseLog do
sex1: "Male", age1: 99,
sex2: "Female",
age2: 20,
owning_organisation: owning_organisation,
managing_organisation: managing_organisation)
owning_organisation:,
managing_organisation:)
}.not_to raise_error
end
end
@ -94,40 +94,40 @@ RSpec.describe CaseLog do
described_class.create!(
first_time_property_let_as_social_housing: "No",
unitletas: "Social rent basis",
owning_organisation: owning_organisation,
managing_organisation: managing_organisation,
owning_organisation:,
managing_organisation:,
)
}.not_to raise_error
expect {
described_class.create!(
first_time_property_let_as_social_housing: "Yes",
unitletas: "Social rent basis",
owning_organisation: owning_organisation,
managing_organisation: managing_organisation,
owning_organisation:,
managing_organisation:,
)
}.to raise_error(ActiveRecord::RecordInvalid)
expect {
described_class.create!(
first_time_property_let_as_social_housing: "Yes",
unitletas: "Affordable rent basis",
owning_organisation: owning_organisation,
managing_organisation: managing_organisation,
owning_organisation:,
managing_organisation:,
)
}.to raise_error(ActiveRecord::RecordInvalid)
expect {
described_class.create!(
first_time_property_let_as_social_housing: "Yes",
unitletas: "Intermediate rent basis",
owning_organisation: owning_organisation,
managing_organisation: managing_organisation,
owning_organisation:,
managing_organisation:,
)
}.to raise_error(ActiveRecord::RecordInvalid)
expect {
described_class.create!(
first_time_property_let_as_social_housing: "Yes",
unitletas: "Don’t know",
owning_organisation: owning_organisation,
managing_organisation: managing_organisation,
owning_organisation:,
managing_organisation:,
)
}.to raise_error(ActiveRecord::RecordInvalid)
end
@ -137,32 +137,32 @@ RSpec.describe CaseLog do
described_class.create!(
first_time_property_let_as_social_housing: "Yes",
rsnvac: "First let of new-build property",
owning_organisation: owning_organisation,
managing_organisation: managing_organisation,
owning_organisation:,
managing_organisation:,
)
}.not_to raise_error
expect {
described_class.create!(
first_time_property_let_as_social_housing: "Yes",
rsnvac: "First let of conversion, rehabilitation or acquired property",
owning_organisation: owning_organisation,
managing_organisation: managing_organisation,
owning_organisation:,
managing_organisation:,
)
}.not_to raise_error
expect {
described_class.create!(
first_time_property_let_as_social_housing: "Yes",
rsnvac: "First let of leased property",
owning_organisation: owning_organisation,
managing_organisation: managing_organisation,
owning_organisation:,
managing_organisation:,
)
}.not_to raise_error
expect {
described_class.create!(
first_time_property_let_as_social_housing: "Yes",
rsnvac: "Tenant moved to care home",
owning_organisation: owning_organisation,
managing_organisation: managing_organisation,
owning_organisation:,
managing_organisation:,
)
}.to raise_error(ActiveRecord::RecordInvalid)
end
@ -173,8 +173,8 @@ RSpec.describe CaseLog do
expect {
described_class.create!(hbrentshortfall: "No",
tshortfall: 99,
owning_organisation: owning_organisation,
managing_organisation: managing_organisation)
owning_organisation:,
managing_organisation:)
}.to raise_error(ActiveRecord::RecordInvalid)
end
end
@ -185,8 +185,8 @@ RSpec.describe CaseLog do
described_class.create!(
benefits: "All",
ecstat1: "Full-time - 30 hours or more",
owning_organisation: owning_organisation,
managing_organisation: managing_organisation,
owning_organisation:,
managing_organisation:,
)
}.to raise_error(ActiveRecord::RecordInvalid)
end
@ -196,8 +196,8 @@ RSpec.describe CaseLog do
described_class.create!(
benefits: "All",
ecstat1: "Part-time - Less than 30 hours",
owning_organisation: owning_organisation,
managing_organisation: managing_organisation,
owning_organisation:,
managing_organisation:,
)
}.to raise_error(ActiveRecord::RecordInvalid)
end
@ -208,8 +208,8 @@ RSpec.describe CaseLog do
benefits: "All",
relat2: "Partner",
ecstat2: "Part-time - Less than 30 hours",
owning_organisation: owning_organisation,
managing_organisation: managing_organisation,
owning_organisation:,
managing_organisation:,
)
}.to raise_error(ActiveRecord::RecordInvalid)
end
@ -220,8 +220,8 @@ RSpec.describe CaseLog do
expect {
described_class.create!(armedforces: "No",
leftreg: "Yes",
owning_organisation: owning_organisation,
managing_organisation: managing_organisation)
owning_organisation:,
managing_organisation:)
}.to raise_error(ActiveRecord::RecordInvalid)
end
@ -231,8 +231,8 @@ RSpec.describe CaseLog do
described_class.create!(armedforces: "A current or former regular in the UK Armed Forces (excluding National Service)",
leftreg: "Yes",
reservist: "Yes",
owning_organisation: owning_organisation,
managing_organisation: managing_organisation)
owning_organisation:,
managing_organisation:)
}.not_to raise_error
end
end
@ -243,8 +243,8 @@ RSpec.describe CaseLog do
described_class.create!(
age2: 14,
relat2: "Partner",
owning_organisation: owning_organisation,
managing_organisation: managing_organisation,
owning_organisation:,
managing_organisation:,
)
}.to raise_error(ActiveRecord::RecordInvalid)
end
@ -254,8 +254,8 @@ RSpec.describe CaseLog do
described_class.create!(
age2: 71,
ecstat2: "Full-time - 30 hours or more",
owning_organisation: owning_organisation,
managing_organisation: managing_organisation,
owning_organisation:,
managing_organisation:,
)
}.to raise_error(ActiveRecord::RecordInvalid)
end
@ -266,8 +266,8 @@ RSpec.describe CaseLog do
age2: 64,
sex2: "Male",
ecstat2: "Retired",
owning_organisation: owning_organisation,
managing_organisation: managing_organisation,
owning_organisation:,
managing_organisation:,
)
}.to raise_error(ActiveRecord::RecordInvalid)
end
@ -278,8 +278,8 @@ RSpec.describe CaseLog do
age2: 59,
sex2: "Female",
ecstat2: "Retired",
owning_organisation: owning_organisation,
managing_organisation: managing_organisation,
owning_organisation:,
managing_organisation:,
)
}.to raise_error(ActiveRecord::RecordInvalid)
end
@ -289,8 +289,8 @@ RSpec.describe CaseLog do
described_class.create!(
age2: 15,
ecstat2: "Full-time - 30 hours or more",
owning_organisation: owning_organisation,
managing_organisation: managing_organisation,
owning_organisation:,
managing_organisation:,
)
}.to raise_error(ActiveRecord::RecordInvalid)
end
@ -301,8 +301,8 @@ RSpec.describe CaseLog do
age2: 17,
relat2: "Child - includes young adult and grown-up",
ecstat2: "Full-time - 30 hours or more",
owning_organisation: owning_organisation,
managing_organisation: managing_organisation,
owning_organisation:,
managing_organisation:,
)
}.to raise_error(ActiveRecord::RecordInvalid)
end
@ -312,8 +312,8 @@ RSpec.describe CaseLog do
described_class.create!(
age2: 15,
relat2: "Partner",
owning_organisation: owning_organisation,
managing_organisation: managing_organisation,
owning_organisation:,
managing_organisation:,
)
}.to raise_error(ActiveRecord::RecordInvalid)
end
@ -323,8 +323,8 @@ RSpec.describe CaseLog do
described_class.create!(
relat2: "Partner",
relat3: "Partner",
owning_organisation: owning_organisation,
managing_organisation: managing_organisation,
owning_organisation:,
managing_organisation:,
)
}.to raise_error(ActiveRecord::RecordInvalid)
end
@ -335,15 +335,15 @@ RSpec.describe CaseLog do
expect {
described_class.create!(tenancy: "Other",
tenancyother: nil,
owning_organisation: owning_organisation,
managing_organisation: managing_organisation)
owning_organisation:,
managing_organisation:)
}.to raise_error(ActiveRecord::RecordInvalid)
expect {
described_class.create!(tenancy: "Other",
tenancyother: "type",
owning_organisation: owning_organisation,
managing_organisation: managing_organisation)
owning_organisation:,
managing_organisation:)
}.not_to raise_error
end
@ -351,15 +351,15 @@ RSpec.describe CaseLog do
expect {
described_class.create!(tenancy: "Secure (including flexible)",
tenancyother: "the other reason provided",
owning_organisation: owning_organisation,
managing_organisation: managing_organisation)
owning_organisation:,
managing_organisation:)
}.to raise_error(ActiveRecord::RecordInvalid)
expect {
described_class.create!(tenancy: "Secure (including flexible)",
tenancyother: nil,
owning_organisation: owning_organisation,
managing_organisation: managing_organisation)
owning_organisation:,
managing_organisation:)
}.not_to raise_error
end
end
@ -371,8 +371,8 @@ RSpec.describe CaseLog do
ecstat1: "Full-time - 30 hours or more",
earnings: 5000,
incfreq: "Weekly",
owning_organisation: owning_organisation,
managing_organisation: managing_organisation,
owning_organisation:,
managing_organisation:,
)
}.to raise_error(ActiveRecord::RecordInvalid)
end
@ -383,8 +383,8 @@ RSpec.describe CaseLog do
ecstat1: "Full-time - 30 hours or more",
earnings: 1,
incfreq: "Weekly",
owning_organisation: owning_organisation,
managing_organisation: managing_organisation,
owning_organisation:,
managing_organisation:,
)
}.to raise_error(ActiveRecord::RecordInvalid)
end
@ -426,8 +426,8 @@ RSpec.describe CaseLog do
described_class.create!(
mrcdate: Date.new(2021, 10, 10),
startdate: Date.new(2021, 10, 9),
owning_organisation: owning_organisation,
managing_organisation: managing_organisation,
owning_organisation:,
managing_organisation:,
)
}.to raise_error(ActiveRecord::RecordInvalid)
@ -435,8 +435,8 @@ RSpec.describe CaseLog do
described_class.create!(
mrcdate: Date.new(2021, 10, 9),
startdate: Date.new(2021, 10, 10),
owning_organisation: owning_organisation,
managing_organisation: managing_organisation,
owning_organisation:,
managing_organisation:,
)
}.not_to raise_error
end
@ -446,8 +446,8 @@ RSpec.describe CaseLog do
described_class.create!(
mrcdate: Date.new(2020, 10, 10),
rsnvac: "First let of new-build property",
owning_organisation: owning_organisation,
managing_organisation: managing_organisation,
owning_organisation:,
managing_organisation:,
)
}.to raise_error(ActiveRecord::RecordInvalid)
@ -455,8 +455,8 @@ RSpec.describe CaseLog do
described_class.create!(
mrcdate: Date.new(2020, 10, 10),
rsnvac: "First let of conversion, rehabilitation or acquired property",
owning_organisation: owning_organisation,
managing_organisation: managing_organisation,
owning_organisation:,
managing_organisation:,
)
}.to raise_error(ActiveRecord::RecordInvalid)
@ -464,8 +464,8 @@ RSpec.describe CaseLog do
described_class.create!(
mrcdate: Date.new(2020, 10, 10),
rsnvac: "First let of leased property",
owning_organisation: owning_organisation,
managing_organisation: managing_organisation,
owning_organisation:,
managing_organisation:,
)
}.to raise_error(ActiveRecord::RecordInvalid)
end
@ -475,8 +475,8 @@ RSpec.describe CaseLog do
described_class.create!(
startdate: Date.new(2021, 10, 10),
mrcdate: Date.new(2017, 10, 10),
owning_organisation: owning_organisation,
managing_organisation: managing_organisation,
owning_organisation:,
managing_organisation:,
)
}.to raise_error(ActiveRecord::RecordInvalid)
end
@ -488,8 +488,8 @@ RSpec.describe CaseLog do
described_class.create!(
startdate: Date.new(2021, 10, 10),
property_void_date: Date.new(2009, 10, 10),
owning_organisation: owning_organisation,
managing_organisation: managing_organisation,
owning_organisation:,
managing_organisation:,
)
}.to raise_error(ActiveRecord::RecordInvalid)
@ -497,8 +497,8 @@ RSpec.describe CaseLog do
described_class.create!(
startdate: Date.new(2021, 10, 10),
property_void_date: Date.new(2015, 10, 10),
owning_organisation: owning_organisation,
managing_organisation: managing_organisation,
owning_organisation:,
managing_organisation:,
)
}.not_to raise_error
end
@ -508,8 +508,8 @@ RSpec.describe CaseLog do
described_class.create!(
startdate: Date.new(2021, 10, 10),
property_void_date: Date.new(2021, 10, 11),
owning_organisation: owning_organisation,
managing_organisation: managing_organisation,
owning_organisation:,
managing_organisation:,
)
}.to raise_error(ActiveRecord::RecordInvalid)
@ -517,8 +517,8 @@ RSpec.describe CaseLog do
described_class.create!(
startdate: Date.new(2021, 10, 10),
property_void_date: Date.new(2019, 10, 10),
owning_organisation: owning_organisation,
managing_organisation: managing_organisation,
owning_organisation:,
managing_organisation:,
)
}.not_to raise_error
end
@ -529,8 +529,8 @@ RSpec.describe CaseLog do
startdate: Date.new(2021, 10, 10),
mrcdate: Date.new(2019, 10, 10),
property_void_date: Date.new(2019, 11, 11),
owning_organisation: owning_organisation,
managing_organisation: managing_organisation,
owning_organisation:,
managing_organisation:,
)
}.to raise_error(ActiveRecord::RecordInvalid)
end
@ -541,15 +541,15 @@ RSpec.describe CaseLog do
expect {
described_class.create!(la: "Ashford",
rent_type: "London Affordable rent",
owning_organisation: owning_organisation,
managing_organisation: managing_organisation)
owning_organisation:,
managing_organisation:)
}.to raise_error(ActiveRecord::RecordInvalid)
expect {
described_class.create!(la: "Westminster",
rent_type: "London Affordable rent",
owning_organisation: owning_organisation,
managing_organisation: managing_organisation)
owning_organisation:,
managing_organisation:)
}.not_to raise_error
end
end
@ -560,8 +560,8 @@ RSpec.describe CaseLog do
described_class.create!(housingneeds_a: "Yes",
housingneeds_b: "Yes",
rent_type: "London Affordable rent",
owning_organisation: owning_organisation,
managing_organisation: managing_organisation)
owning_organisation:,
managing_organisation:)
}.to raise_error(ActiveRecord::RecordInvalid)
end
@ -570,32 +570,32 @@ RSpec.describe CaseLog do
described_class.create!(housingneeds_a: "Yes",
housingneeds_f: "Yes",
rent_type: "London Affordable rent",
owning_organisation: owning_organisation,
managing_organisation: managing_organisation)
owning_organisation:,
managing_organisation:)
}.not_to raise_error
expect {
described_class.create!(housingneeds_b: "Yes",
housingneeds_f: "Yes",
rent_type: "London Affordable rent",
owning_organisation: owning_organisation,
managing_organisation: managing_organisation)
owning_organisation:,
managing_organisation:)
}.not_to raise_error
expect {
described_class.create!(housingneeds_c: "Yes",
housingneeds_f: "Yes",
rent_type: "London Affordable rent",
owning_organisation: owning_organisation,
managing_organisation: managing_organisation)
owning_organisation:,
managing_organisation:)
}.not_to raise_error
expect {
described_class.create!(housingneeds_g: "Yes",
housingneeds_f: "Yes",
rent_type: "London Affordable rent",
owning_organisation: owning_organisation,
managing_organisation: managing_organisation)
owning_organisation:,
managing_organisation:)
}.to raise_error(ActiveRecord::RecordInvalid)
expect {
@ -603,8 +603,8 @@ RSpec.describe CaseLog do
housingneeds_b: "Yes",
housingneeds_f: "Yes",
rent_type: "London Affordable rent",
owning_organisation: owning_organisation,
managing_organisation: managing_organisation)
owning_organisation:,
managing_organisation:)
}.to raise_error(ActiveRecord::RecordInvalid)
end
end
@ -613,18 +613,18 @@ RSpec.describe CaseLog do
def check_rsnvac_validation(prevten)
expect {
described_class.create!(rsnvac: "Relet to tenant who occupied same property as temporary accommodation",
prevten: prevten,
owning_organisation: owning_organisation,
managing_organisation: managing_organisation)
prevten:,
owning_organisation:,
managing_organisation:)
}.to raise_error(ActiveRecord::RecordInvalid)
end
def check_rsnvac_referral_validation(referral)
expect {
described_class.create!(rsnvac: "Relet to tenant who occupied same property as temporary accommodation",
referral: referral,
owning_organisation: owning_organisation,
managing_organisation: managing_organisation)
referral:,
owning_organisation:,
managing_organisation:)
}.to raise_error(ActiveRecord::RecordInvalid)
end

2
spec/requests/auth/passwords_controller_spec.rb

@ -2,7 +2,7 @@ require "rails_helper"
require_relative "../../support/devise"
RSpec.describe Auth::PasswordsController, type: :request do
let(:params) { { user: { email: email } } }
let(:params) { { user: { email: } } }
let(:page) { Capybara::Node::Simple.new(response.body) }
let(:notify_client) { instance_double(Notifications::Client) }
let(:devise_notify_mailer) { DeviseNotifyMailer.new }

2
spec/requests/form_controller_spec.rb

@ -212,7 +212,7 @@ RSpec.describe FormController, type: :request do
accessibility_requirements:
%w[ housingneeds_a
housingneeds_f],
tenant_code: tenant_code,
tenant_code:,
},
}
end

4
spec/requests/users_controller_spec.rb

@ -102,7 +102,7 @@ RSpec.describe UsersController, type: :request do
describe "title link" do
it "routes user to the /logs page" do
get "/", headers: headers, params: {}
get "/", headers:, params: {}
expected_link = "href=\"/\">#{I18n.t('service_name')}</a>"
expect(CGI.unescape_html(response.body)).to include(expected_link)
end
@ -256,7 +256,7 @@ RSpec.describe UsersController, type: :request do
end
it "routes user to the /logs page" do
get "/", headers: headers, params: {}
get "/", headers:, params: {}
expected_link = "href=\"/logs\">#{I18n.t('service_name')}</a>"
follow_redirect!
expect(CGI.unescape_html(response.body)).to include(expected_link)

2
spec/services/storage_service_spec.rb

@ -57,7 +57,7 @@ RSpec.describe StorageService do
aws_access_key_id: "key_id",
aws_region: "eu-west-2",
aws_secret_access_key: "secret",
bucket_name: bucket_name,
bucket_name:,
},
)
expect(storage_service.configuration).to eq(expected_configuration)

Loading…
Cancel
Save