Browse Source

Add specs for DataExport{Xml,Csv}Job

pull/952/head
James Rose 4 years ago committed by Kat
parent
commit
f0f7cadc89
  1. 19
      Gemfile.lock
  2. 19
      spec/jobs/data_export_csv_job_spec.rb
  3. 27
      spec/jobs/data_export_xml_job_spec.rb

19
Gemfile.lock

@ -157,13 +157,7 @@ GEM
rainbow
rubocop
smart_properties
<<<<<<< HEAD
erubi (1.12.0)
=======
erubi (1.11.0)
et-orbi (1.2.7)
tzinfo
>>>>>>> 6991b683 (Schedule data export tasks in sidekiq-cron)
excon (0.92.5)
factory_bot (6.2.1)
activesupport (>= 5.0.0)
@ -173,14 +167,7 @@ GEM
faker (2.23.0)
i18n (>= 1.8.11, < 2)
ffi (1.15.5)
<<<<<<< HEAD
globalid (1.0.1)
=======
fugit (1.7.1)
et-orbi (~> 1, >= 1.2.7)
raabro (~> 1.4)
globalid (1.0.0)
>>>>>>> 6991b683 (Schedule data export tasks in sidekiq-cron)
activesupport (>= 5.0)
govuk-components (3.2.1)
actionpack (>= 6.1)
@ -280,14 +267,8 @@ GEM
public_suffix (5.0.0)
puma (5.6.5)
nio4r (~> 2.0)
<<<<<<< HEAD
racc (1.6.2)
rack (2.2.6.2)
=======
raabro (1.4.0)
racc (1.6.0)
rack (2.2.4)
>>>>>>> 6991b683 (Schedule data export tasks in sidekiq-cron)
rack-attack (6.6.1)
rack (>= 1.0, < 3)
rack-mini-profiler (2.3.4)

19
spec/jobs/data_export_csv_job_spec.rb

@ -0,0 +1,19 @@
require "rails_helper"
describe DataExportCsvJob do
let(:storage_service) { instance_double(Storage::S3Service) }
let(:paas_config_service) { instance_double(Configuration::PaasConfigurationService) }
let(:export_service) { instance_double(Exports::LettingsLogExportService) }
before do
allow(Storage::S3Service).to receive(:new).and_return(storage_service)
allow(Configuration::PaasConfigurationService).to receive(:new).and_return(paas_config_service)
allow(Exports::LettingsLogExportService).to receive(:new).and_return(export_service)
end
it "calls the export service" do
expect(export_service).to receive(:export_csv_lettings_logs)
described_class.perform_now
end
end

27
spec/jobs/data_export_xml_job_spec.rb

@ -0,0 +1,27 @@
require "rails_helper"
describe DataExportXmlJob do
let(:storage_service) { instance_double(Storage::S3Service) }
let(:paas_config_service) { instance_double(Configuration::PaasConfigurationService) }
let(:export_service) { instance_double(Exports::LettingsLogExportService) }
before do
allow(Storage::S3Service).to receive(:new).and_return(storage_service)
allow(Configuration::PaasConfigurationService).to receive(:new).and_return(paas_config_service)
allow(Exports::LettingsLogExportService).to receive(:new).and_return(export_service)
end
it "calls the export service" do
expect(export_service).to receive(:export_xml_lettings_logs)
described_class.perform_now
end
context "with full update enabled" do
it "calls the export service" do
expect(export_service).to receive(:export_xml_lettings_logs).with(full_update: true)
described_class.perform_now(full_update: true)
end
end
end
Loading…
Cancel
Save