diff --git a/spec/requests/organisation_relationships_controller_spec.rb b/spec/requests/organisation_relationships_controller_spec.rb index 9dc242e05..88823bb91 100644 --- a/spec/requests/organisation_relationships_controller_spec.rb +++ b/spec/requests/organisation_relationships_controller_spec.rb @@ -192,19 +192,17 @@ RSpec.describe OrganisationRelationshipsController, type: :request do describe "organisation_relationships#delete_housing_provider" do let!(:housing_provider) { FactoryBot.create(:organisation) } - - before do - FactoryBot.create(:organisation_relationship, :owning, child_organisation: organisation, parent_organisation: housing_provider) - end - let(:params) do { "organisation_to_remove_id": housing_provider.id, } end - let(:request) { delete "/organisations/#{organisation.id}/housing-providers", headers:, params: } + before do + FactoryBot.create(:organisation_relationship, :owning, child_organisation: organisation, parent_organisation: housing_provider) + end + it "deletes the new organisation relationship" do expect { request }.to change(OrganisationRelationship, :count).by(-1) end @@ -396,19 +394,17 @@ RSpec.describe OrganisationRelationshipsController, type: :request do describe "organisation_relationships#delete_housing_provider" do let!(:housing_provider) { FactoryBot.create(:organisation) } - - before do - FactoryBot.create(:organisation_relationship, :owning, child_organisation: organisation, parent_organisation: housing_provider) - end - let(:params) do { "organisation_to_remove_id": housing_provider.id, } end - let(:request) { delete "/organisations/#{organisation.id}/housing-providers", headers:, params: } + before do + FactoryBot.create(:organisation_relationship, :owning, child_organisation: organisation, parent_organisation: housing_provider) + end + it "deletes the new organisation relationship" do expect { request }.to change(OrganisationRelationship, :count).by(-1) end