Browse Source

test: check housing prov. still selectable after deleting relationship

fix-remove-attr-accessors-from-questions-in-cldc-1723
Sam Seed 2 years ago
parent
commit
f377bc0c16
  1. 16
      spec/models/form/lettings/questions/stock_owner_spec.rb

16
spec/models/form/lettings/questions/stock_owner_spec.rb

@ -64,6 +64,22 @@ RSpec.describe Form::Lettings::Questions::StockOwner, type: :model do
user.organisation.update!(holds_own_stock: true)
expect(question.displayed_answer_options(log, user)).to eq(options)
end
context "when the owning-managing organisation relationship is deleted" do
let(:options) do
{
"" => "Select an option",
user.organisation.id => "User org (Your organisation)",
owning_org_2.id => "Owning org 2"
}
end
it "doesn't remove the housing provider from the list of allowed housing providers" do
log.update!(owning_organisation: owning_org_2)
expect(question.displayed_answer_options(log, user)).to eq(options)
org_rel.destroy!
expect(question.displayed_answer_options(log, user)).to eq(options)
end
end
end
context "when user's org doesn't own stock" do

Loading…
Cancel
Save