From 3cc29b79b5bc7998623d51000d25bb866fc7bf37 Mon Sep 17 00:00:00 2001 From: Sam Seed Date: Wed, 18 Jan 2023 13:58:13 +0000 Subject: [PATCH] test: remove if statement from "coordinator user's org does hold stock" no managing orgs managing org test --- spec/features/lettings_log_spec.rb | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/spec/features/lettings_log_spec.rb b/spec/features/lettings_log_spec.rb index 27c463c99..b9ad58b3d 100644 --- a/spec/features/lettings_log_spec.rb +++ b/spec/features/lettings_log_spec.rb @@ -286,6 +286,9 @@ RSpec.describe "Lettings Log Features" do end context "when the current user's organisation does hold stock" do + let!(:owning_org1) { create(:organisation, name: "Owning org 1") } + let!(:org_rel1) { create(:organisation_relationship, child_organisation: user.organisation, parent_organisation: owning_org1) } + before do user.organisation.update!(holds_own_stock: true) end @@ -296,12 +299,13 @@ RSpec.describe "Lettings Log Features" do click_button("Create a new lettings log") click_link("Set up this lettings log") log_id = page.current_path.scan(/\d/).join - if page.current_path == "/lettings-logs/#{log_id}/owning-organisation" - click_link("Skip for now") - end + 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).not_to have_current_path("/lettings-logs/#{log_id}/managing-organisation") visit("lettings-logs/#{log_id}/setup/check-answers") expect(page).not_to have_content("Managing agent ") + expect(user.organisation.stock_owners).to eq([org_rel1.parent_organisation]) end end