Browse Source

lint

pull/765/head
Ted-U 3 years ago committed by baarkerlounger
parent
commit
3d7f4fabef
  1. 6
      spec/features/organisation_spec.rb
  2. 2
      spec/mailers/devise_notify_mailer_spec.rb

6
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!(: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!(:scheme_to_delete) { FactoryBot.create(:scheme, owning_organisation: user.organisation) }
let!(:log_to_delete) { FactoryBot.create(:case_log, owning_organisation: user.organisation) } let!(:log_to_delete) { FactoryBot.create(:case_log, owning_organisation: user.organisation) }
context "when organisation is deleted" do context "when organisation is deleted" do
it "child relationships ie logs, schemes and users are deleted too - application" do it "child relationships ie logs, schemes and users are deleted too - application" do
organisation.destroy! organisation.destroy!
@ -234,13 +234,13 @@ RSpec.describe "User Features" do
expect { Scheme.find(scheme_to_delete.id) }.to raise_error(ActiveRecord::RecordNotFound) expect { Scheme.find(scheme_to_delete.id) }.to raise_error(ActiveRecord::RecordNotFound)
expect { User.find(user.id) }.to raise_error(ActiveRecord::RecordNotFound) expect { User.find(user.id) }.to raise_error(ActiveRecord::RecordNotFound)
end end
context "when the organisation is deleted" do context "when the organisation is deleted" do
let!(:organisation) { FactoryBot.create(:organisation) } let!(:organisation) { FactoryBot.create(:organisation) }
let!(:user) { FactoryBot.create(:user, :support, last_sign_in_at: Time.zone.now, 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!(: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) } 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 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};") ActiveRecord::Base.connection.exec_query("DELETE FROM organisations WHERE id = #{organisation.id};")
expect { CaseLog.find(log_to_delete.id) }.to raise_error(ActiveRecord::RecordNotFound) expect { CaseLog.find(log_to_delete.id) }.to raise_error(ActiveRecord::RecordNotFound)

2
spec/mailers/devise_notify_mailer_spec.rb

@ -52,4 +52,4 @@ RSpec.describe DeviseNotifyMailer do
end end
end end
end end
end end

Loading…
Cancel
Save