From 17a9319342128a76be8f531856fcc1dc68d1e4a6 Mon Sep 17 00:00:00 2001 From: Aaron Spencer Date: Mon, 3 Jul 2023 16:20:15 +0100 Subject: [PATCH] CLDC-1863: Test updated --- spec/models/form/lettings/questions/stock_owner_spec.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/spec/models/form/lettings/questions/stock_owner_spec.rb b/spec/models/form/lettings/questions/stock_owner_spec.rb index 3bd6d72e2..ed05c5139 100644 --- a/spec/models/form/lettings/questions/stock_owner_spec.rb +++ b/spec/models/form/lettings/questions/stock_owner_spec.rb @@ -107,15 +107,17 @@ RSpec.describe Form::Lettings::Questions::StockOwner, type: :model do let(:log) { create(:lettings_log) } + let(:non_stock_organisation) { create(:organisation, holds_own_stock: false) } let(:expected_opts) do - Organisation.all.each_with_object(options) do |organisation, hsh| + Organisation.where(holds_own_stock: true).each_with_object(options) do |organisation, hsh| hsh[organisation.id] = organisation.name hsh end end - it "shows all orgs" do + it "shows orgs where organisation holds own stock" do expect(question.displayed_answer_options(log, user)).to eq(expected_opts) + expect(question.displayed_answer_options(log, user)).not_to include(non_stock_organisation.id) end end end