Browse Source

Mock in the right spec

pull/580/head
baarkerlounger 3 years ago
parent
commit
33768b41c9
  1. 8
      spec/services/imports/case_logs_import_service_spec.rb
  2. 8
      spec/services/imports/user_import_service_spec.rb

8
spec/services/imports/case_logs_import_service_spec.rb

@ -10,14 +10,6 @@ RSpec.describe Imports::CaseLogsImportService do
let(:real_2021_2022_form) { Form.new("config/forms/2021_2022.json", "2021_2022") }
let(:real_2022_2023_form) { Form.new("config/forms/2022_2023.json", "2022_2023") }
let(:logger) { instance_double(ActiveSupport::Logger) }
let(:notify_client) { instance_double(Notifications::Client) }
let(:devise_notify_mailer) { DeviseNotifyMailer.new }
before do
allow(DeviseNotifyMailer).to receive(:new).and_return(devise_notify_mailer)
allow(devise_notify_mailer).to receive(:notify_client).and_return(notify_client)
allow(notify_client).to receive(:send_email).and_return(true)
end
context "when importing users" do
subject(:case_log_service) { described_class.new(storage_service, logger) }

8
spec/services/imports/user_import_service_spec.rb

@ -7,6 +7,14 @@ RSpec.describe Imports::UserImportService do
let(:user_file) { File.open("#{fixture_directory}/#{old_user_id}.xml") }
let(:storage_service) { instance_double(StorageService) }
let(:logger) { instance_double(ActiveSupport::Logger) }
let(:notify_client) { instance_double(Notifications::Client) }
let(:devise_notify_mailer) { DeviseNotifyMailer.new }
before do
allow(DeviseNotifyMailer).to receive(:new).and_return(devise_notify_mailer)
allow(devise_notify_mailer).to receive(:notify_client).and_return(notify_client)
allow(notify_client).to receive(:send_email).and_return(true)
end
context "when importing users" do
subject(:import_service) { described_class.new(storage_service, logger) }

Loading…
Cancel
Save