diff --git a/lib/tasks/data_export.rake b/lib/tasks/data_export.rake index 20a383772..e57c3779d 100644 --- a/lib/tasks/data_export.rake +++ b/lib/tasks/data_export.rake @@ -13,7 +13,7 @@ namespace :core do desc "Export all data XMLs for import into Central Data System (CDS)" task :full_data_export_xml, %i[year] => :environment do |_task, args| - collection_year = args[:year].presence + collection_year = args[:year].present? ? args[:year].to_i : nil storage_service = Storage::S3Service.new(PlatformHelper.is_paas? ? Configuration::PaasConfigurationService.new : Configuration::EnvConfigurationService.new, ENV["EXPORT_PAAS_INSTANCE"]) export_service = Exports::LettingsLogExportService.new(storage_service) diff --git a/spec/lib/tasks/data_export_spec.rb b/spec/lib/tasks/data_export_spec.rb index bb407edd2..5a08ac40a 100644 --- a/spec/lib/tasks/data_export_spec.rb +++ b/spec/lib/tasks/data_export_spec.rb @@ -42,7 +42,7 @@ describe "rake core:data_export", type: task do it "calls the export service" do expect(export_service).to receive(:export_xml_lettings_logs).with(full_update: true, collection_year: 2022) - task.invoke(2022) + task.invoke("2022") end end end