diff --git a/app/models/form/lettings/questions/housing_provider.rb b/app/models/form/lettings/questions/housing_provider.rb index f0b69f9f7..8d8db24b6 100644 --- a/app/models/form/lettings/questions/housing_provider.rb +++ b/app/models/form/lettings/questions/housing_provider.rb @@ -59,10 +59,10 @@ private end def housing_providers_answer_options - @housing_providers_answer_options ||= if current_user.support? - Organisation - else - current_user.organisation.housing_providers - end.pluck(:id, :name).to_h + if current_user.support? + Organisation + else + current_user.organisation.housing_providers + end.pluck(:id, :name).to_h end end diff --git a/app/models/form/lettings/questions/managing_organisation.rb b/app/models/form/lettings/questions/managing_organisation.rb index ff6da010a..42662202c 100644 --- a/app/models/form/lettings/questions/managing_organisation.rb +++ b/app/models/form/lettings/questions/managing_organisation.rb @@ -65,10 +65,10 @@ private end def managing_organisations_answer_options - @managing_organisations_answer_options ||= if current_user.support? - log.owning_organisation - else - current_user.organisation - end.managing_agents.pluck(:id, :name).to_h + if current_user.support? + log.owning_organisation + else + current_user.organisation + end.managing_agents.pluck(:id, :name).to_h end end diff --git a/spec/features/lettings_log_spec.rb b/spec/features/lettings_log_spec.rb index 294ef51cd..91901659a 100644 --- a/spec/features/lettings_log_spec.rb +++ b/spec/features/lettings_log_spec.rb @@ -99,7 +99,7 @@ RSpec.describe "Lettings Log Features" do end context "when the signed is user is not a Support user" do - let(:support_user) { create(:user) } + let(:user) { create(:user) } let(:devise_notify_mailer) { DeviseNotifyMailer.new } let(:notify_client) { instance_double(Notifications::Client) } @@ -108,8 +108,8 @@ RSpec.describe "Lettings Log Features" do allow(devise_notify_mailer).to receive(:notify_client).and_return(notify_client) allow(notify_client).to receive(:send_email).and_return(true) visit("/account/sign-in") - fill_in("user[email]", with: support_user.email) - fill_in("user[password]", with: support_user.password) + fill_in("user[email]", with: user.email) + fill_in("user[password]", with: user.password) click_button("Sign in") end @@ -121,8 +121,8 @@ RSpec.describe "Lettings Log Features" do log_id = page.current_path.scan(/\d/).join expect(page).to have_current_path("/lettings-logs/#{log_id}/needs-type") visit("lettings-logs/#{log_id}/setup/check-answers") - expect(page).not_to have_content("Owning organisation #{support_user.organisation.name}") - expect(page).not_to have_content("User #{support_user.name}") + expect(page).not_to have_content("Owning organisation #{user.organisation.name}") + expect(page).not_to have_content("User #{user.name}") expect(page).to have_content("You have answered 0 of 6 questions") end end