Browse Source

Add test

pull/2066/head
Kat 2 years ago
parent
commit
9d49c67b59
  1. 24
      spec/requests/schemes_controller_spec.rb

24
spec/requests/schemes_controller_spec.rb

@ -2229,12 +2229,14 @@ RSpec.describe SchemesController, type: :request do
get "/schemes/#{scheme.id}/edit-name" get "/schemes/#{scheme.id}/edit-name"
end end
it "does not include the owning organisation question" do context "and there are no absorbed organisations" do
expect(response).to have_http_status(:ok) it "does not include the owning organisation question" do
expect(page).not_to have_content("Which organisation owns the housing stock for this scheme?") expect(response).to have_http_status(:ok)
expect(page).not_to have_content("Which organisation owns the housing stock for this scheme?")
end
end end
context "and there are absorbed organisations" do context "and there are organisations absorbed during an open collection period" do
let(:merged_organisation) { create(:organisation) } let(:merged_organisation) { create(:organisation) }
before do before do
@ -2247,6 +2249,20 @@ RSpec.describe SchemesController, type: :request do
expect(page).to have_content("Which organisation owns the housing stock for this scheme?") expect(page).to have_content("Which organisation owns the housing stock for this scheme?")
end end
end end
context "and there are no recently absorbed organisations" do
let(:merged_organisation) { create(:organisation) }
before do
merged_organisation.update!(absorbing_organisation: user.organisation, merge_date: Time.zone.today - 2.years)
get "/schemes/#{scheme.id}/edit-name"
end
it "does not include the owning organisation question" do
expect(response).to have_http_status(:ok)
expect(page).not_to have_content("Which organisation owns the housing stock for this scheme?")
end
end
end end
context "when attempting to access secondary-client-group scheme page for another organisation" do context "when attempting to access secondary-client-group scheme page for another organisation" do

Loading…
Cancel
Save