From c80e322e733fdcacb81ca283735135733256e97b Mon Sep 17 00:00:00 2001 From: Kat Date: Mon, 3 Jul 2023 12:05:42 +0100 Subject: [PATCH] Update feature test --- spec/features/lettings_log_spec.rb | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/spec/features/lettings_log_spec.rb b/spec/features/lettings_log_spec.rb index 2e83b669c..fc761f184 100644 --- a/spec/features/lettings_log_spec.rb +++ b/spec/features/lettings_log_spec.rb @@ -338,7 +338,7 @@ RSpec.describe "Lettings Log Features" do let!(:org_rel1) { create(:organisation_relationship, child_organisation: user.organisation, parent_organisation: owning_org1) } let!(:org_rel2) { create(:organisation_relationship, child_organisation: user.organisation, parent_organisation: owning_org2) } - it "shows the managing organisation question" do + it "does not show the managing organisation question, because managing organisation can be inferred" do user.organisation.update!(holds_own_stock: false) visit("/lettings-logs") click_button("Create a new lettings log") @@ -347,13 +347,11 @@ RSpec.describe "Lettings Log Features" do expect(page).to have_current_path("/lettings-logs/#{log_id}/stock-owner") select(owning_org1.name, from: "lettings-log-owning-organisation-id-field") click_button("Save and continue") - expect(page).to have_current_path("/lettings-logs/#{log_id}/managing-organisation") - select(user.organisation.name, from: "lettings-log-managing-organisation-id-field") - click_button("Save and continue") visit("lettings-logs/#{log_id}/setup/check-answers") - expect(page).to have_content("Managing agent User org", normalize_ws: true) + expect(page).not_to have_content("Managing agent User org", normalize_ws: true) expect(user.organisation.stock_owners).to eq([org_rel1.parent_organisation, org_rel2.parent_organisation]) + expect(LettingsLog.find(log_id).managing_organisation).to eq(user.organisation) end end