From 3bf0f30d10115aa024d13ce9a3038e5ab2a23436 Mon Sep 17 00:00:00 2001 From: natdeanlewissoftwire Date: Fri, 24 Mar 2023 09:46:49 +0000 Subject: [PATCH] feat: test unconfirmed locations aren't options in location_id --- .../form/lettings/questions/location_id_spec.rb | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/spec/models/form/lettings/questions/location_id_spec.rb b/spec/models/form/lettings/questions/location_id_spec.rb index ab843b673..ef8c5fe88 100644 --- a/spec/models/form/lettings/questions/location_id_spec.rb +++ b/spec/models/form/lettings/questions/location_id_spec.rb @@ -111,7 +111,19 @@ RSpec.describe Form::Lettings::Questions::LocationId, type: :model do lettings_log.update!(scheme:) end - it "the displayed_answer_options shows the active location" do + it "the displayed_answer_options shows only the active location" do + expect(question.displayed_answer_options(lettings_log).count).to eq(1) + end + end + + context "and some locations are not confirmed" do + before do + FactoryBot.create(:location, scheme:, confirmed: false) + FactoryBot.create(:location, scheme:, confirmed: true) + lettings_log.update!(scheme:) + end + + it "the displayed_answer_options shows only the confirmed location" do expect(question.displayed_answer_options(lettings_log).count).to eq(1) end end