diff --git a/spec/features/organisation_spec.rb b/spec/features/organisation_spec.rb index aa42c15ed..ee7ec0c37 100644 --- a/spec/features/organisation_spec.rb +++ b/spec/features/organisation_spec.rb @@ -225,7 +225,7 @@ RSpec.describe "User Features" do let!(:user) { FactoryBot.create(:user, :support, last_sign_in_at: Time.zone.now, organisation:) } let!(:scheme_to_delete) { FactoryBot.create(:scheme, owning_organisation: user.organisation) } let!(:log_to_delete) { FactoryBot.create(:case_log, owning_organisation: user.organisation) } - + context "when organisation is deleted" do it "child relationships ie logs, schemes and users are deleted too - application" do organisation.destroy! @@ -234,13 +234,13 @@ RSpec.describe "User Features" do expect { Scheme.find(scheme_to_delete.id) }.to raise_error(ActiveRecord::RecordNotFound) expect { User.find(user.id) }.to raise_error(ActiveRecord::RecordNotFound) end - + context "when the organisation is deleted" do let!(:organisation) { FactoryBot.create(:organisation) } let!(:user) { FactoryBot.create(:user, :support, last_sign_in_at: Time.zone.now, organisation:) } let!(:scheme_to_delete) { FactoryBot.create(:scheme, owning_organisation: user.organisation) } let!(:log_to_delete) { FactoryBot.create(:case_log, :in_progress, needstype: 1, owning_organisation: user.organisation) } - + it "child relationships ie logs, schemes and users are deleted too - database" do ActiveRecord::Base.connection.exec_query("DELETE FROM organisations WHERE id = #{organisation.id};") expect { CaseLog.find(log_to_delete.id) }.to raise_error(ActiveRecord::RecordNotFound) diff --git a/spec/mailers/devise_notify_mailer_spec.rb b/spec/mailers/devise_notify_mailer_spec.rb index 883874c0a..a086eddaf 100644 --- a/spec/mailers/devise_notify_mailer_spec.rb +++ b/spec/mailers/devise_notify_mailer_spec.rb @@ -52,4 +52,4 @@ RSpec.describe DeviseNotifyMailer do end end end -end \ No newline at end of file +end