diff --git a/lib/exporter.rb b/lib/exporter.rb index 0a22a334..999b510d 100644 --- a/lib/exporter.rb +++ b/lib/exporter.rb @@ -11,7 +11,7 @@ class Exporter @user = user @obj = {} @export_dirname = Dir.mktmpdir("rs-export-") - @export_filename = "#{File.basename(@export_dirname)}.tar.gz" + @export_filename = "#{File.basename(@export_dirname)}" end def export @@ -133,8 +133,8 @@ class Exporter end def publish - `tar czvf #{Rails.root.join "public", "export", @export_filename} -C /tmp/rs_export #{@export_dirname}` - url = "#{APP_CONFIG['https'] ? 'https' : 'http'}://#{APP_CONFIG['hostname']}/export/#{@export_filename}" + `tar czvf #{Rails.root.join "public", "export", "#{@export_filename}.tar.gz"} -C /tmp/rs_export #{@export_dirname}` + url = "#{APP_CONFIG['https'] ? 'https' : 'http'}://#{APP_CONFIG['hostname']}/export/#{@export_filename}.tar.gz" @user.export_processing = false @user.export_url = url @user.export_created_at = Time.now.utc diff --git a/spec/lib/exporter_spec.rb b/spec/lib/exporter_spec.rb index d15051c0..fb8bc0a2 100644 --- a/spec/lib/exporter_spec.rb +++ b/spec/lib/exporter_spec.rb @@ -313,8 +313,8 @@ RSpec.describe Exporter do it "publishes an archive" do Timecop.freeze do expect { subject }.to change { user.export_processing }.from(true).to(false) - expect(File.exist?("#{fake_rails_root}/public/export/#{name}")).to eq(true) - expect(user.export_url).to eq("https://example.com/export/#{name}") + expect(File.exist?("#{fake_rails_root}/public/export/#{name}.tar.gz")).to eq(true) + expect(user.export_url).to eq("https://example.com/export/#{name}.tar.gz") expect(user.export_created_at).to eq(Time.now.utc) expect(user).to be_persisted end