diff --git a/app/models/form/lettings/pages/managing_organisation.rb b/app/models/form/lettings/pages/managing_organisation.rb index fc2ef5e36..4006a3fb3 100644 --- a/app/models/form/lettings/pages/managing_organisation.rb +++ b/app/models/form/lettings/pages/managing_organisation.rb @@ -25,13 +25,6 @@ class Form::Lettings::Pages::ManagingOrganisation < ::Form::Page return false unless organisation return true unless organisation.holds_own_stock? - managing_agents = organisation.managing_agents - - return false if managing_agents.count.zero? - return true if managing_agents.count > 1 - - log.update!(managing_organisation: managing_agents.first) - - false + organisation.managing_agents.count > 1 end end diff --git a/spec/models/form/lettings/pages/managing_organisation_spec.rb b/spec/models/form/lettings/pages/managing_organisation_spec.rb index 4a44aa25d..3a5aa1c8d 100644 --- a/spec/models/form/lettings/pages/managing_organisation_spec.rb +++ b/spec/models/form/lettings/pages/managing_organisation_spec.rb @@ -40,10 +40,6 @@ RSpec.describe Form::Lettings::Pages::ManagingOrganisation, type: :model do it "is not shown" do expect(page.routed_to?(log, nil)).to eq(false) end - - it "does not update managing_organisation_id" do - expect { page.routed_to?(log, nil) }.not_to change(log.reload, :managing_organisation) - end end context "when support" do @@ -56,10 +52,6 @@ RSpec.describe Form::Lettings::Pages::ManagingOrganisation, type: :model do it "is shown" do expect(page.routed_to?(log, user)).to eq(true) end - - it "does not update managing_organisation_id" do - expect { page.routed_to?(log, user) }.not_to change(log.reload, :managing_organisation) - end end context "when owning_organisation not set" do @@ -69,10 +61,6 @@ RSpec.describe Form::Lettings::Pages::ManagingOrganisation, type: :model do it "is not shown" do expect(page.routed_to?(log, user)).to eq(false) end - - it "does not update managing_organisation_id" do - expect { page.routed_to?(log, user) }.not_to change(log.reload, :managing_organisation) - end end context "when holds own stock" do @@ -84,10 +72,6 @@ RSpec.describe Form::Lettings::Pages::ManagingOrganisation, type: :model do it "is not shown" do expect(page.routed_to?(log, user)).to eq(false) end - - it "does not update managing_organisation_id" do - expect { page.routed_to?(log, user) }.not_to change(log.reload, :managing_organisation) - end end context "with >1 managing_agents" do @@ -99,10 +83,6 @@ RSpec.describe Form::Lettings::Pages::ManagingOrganisation, type: :model do it "is shown" do expect(page.routed_to?(log, user)).to eq(true) end - - it "does not update managing_organisation_id" do - expect { page.routed_to?(log, user) }.not_to change(log.reload, :managing_organisation) - end end context "with 1 managing_agents" do @@ -120,10 +100,6 @@ RSpec.describe Form::Lettings::Pages::ManagingOrganisation, type: :model do it "is not shown" do expect(page.routed_to?(log, user)).to eq(false) end - - it "updates managing_organisation_id" do - expect { page.routed_to?(log, user) }.to change(log.reload, :managing_organisation).to(managing_agent) - end end end end @@ -137,10 +113,6 @@ RSpec.describe Form::Lettings::Pages::ManagingOrganisation, type: :model do it "is shown" do expect(page.routed_to?(log, user)).to eq(true) end - - it "does not update managing_organisation_id" do - expect { page.routed_to?(log, user) }.not_to change(log.reload, :managing_organisation) - end end context "when holds own stock" do @@ -152,10 +124,6 @@ RSpec.describe Form::Lettings::Pages::ManagingOrganisation, type: :model do it "is not shown" do expect(page.routed_to?(log, user)).to eq(false) end - - it "does not update managing_organisation_id" do - expect { page.routed_to?(log, user) }.not_to change(log.reload, :managing_organisation) - end end context "with >1 managing_agents" do @@ -167,10 +135,6 @@ RSpec.describe Form::Lettings::Pages::ManagingOrganisation, type: :model do it "is shown" do expect(page.routed_to?(log, user)).to eq(true) end - - it "does not update managing_organisation_id" do - expect { page.routed_to?(log, user) }.not_to change(log.reload, :managing_organisation) - end end context "with 1 managing_agents" do @@ -188,10 +152,6 @@ RSpec.describe Form::Lettings::Pages::ManagingOrganisation, type: :model do it "is not shown" do expect(page.routed_to?(log, user)).to eq(false) end - - it "updates managing_organisation_id" do - expect { page.routed_to?(log, user) }.to change(log.reload, :managing_organisation).to(managing_agent) - end end end end