|
|
|
@ -338,7 +338,7 @@ RSpec.describe "Lettings Log Features" do
|
|
|
|
|
let!(:org_rel1) { create(:organisation_relationship, child_organisation: user.organisation, parent_organisation: owning_org1) } |
|
|
|
|
let!(:org_rel2) { create(:organisation_relationship, child_organisation: user.organisation, parent_organisation: owning_org2) } |
|
|
|
|
|
|
|
|
|
it "shows the managing organisation question" do |
|
|
|
|
it "does not show the managing organisation question, because managing organisation can be inferred" do |
|
|
|
|
user.organisation.update!(holds_own_stock: false) |
|
|
|
|
visit("/lettings-logs") |
|
|
|
|
click_button("Create a new lettings log") |
|
|
|
@ -347,13 +347,11 @@ RSpec.describe "Lettings Log Features" do
|
|
|
|
|
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).to have_current_path("/lettings-logs/#{log_id}/managing-organisation") |
|
|
|
|
select(user.organisation.name, from: "lettings-log-managing-organisation-id-field") |
|
|
|
|
click_button("Save and continue") |
|
|
|
|
visit("lettings-logs/#{log_id}/setup/check-answers") |
|
|
|
|
|
|
|
|
|
expect(page).to have_content("Managing agent User org", normalize_ws: true) |
|
|
|
|
expect(page).not_to have_content("Managing agent User org", normalize_ws: true) |
|
|
|
|
expect(user.organisation.stock_owners).to eq([org_rel1.parent_organisation, org_rel2.parent_organisation]) |
|
|
|
|
expect(LettingsLog.find(log_id).managing_organisation).to eq(user.organisation) |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|