I'm upgrading my project from Rails 4 to 5 (currently to 5.0.7.2) and I run my tests.
At a simply download in my test I get the following error (however the same functionality in the browser has no problem):
1) Transmittal Pages Download Zip File Should give the correct file
Failure/Error: click_link I18n.t(:download_zip_file)
ZipTricks::PathSet::Conflict:
The file at "test-rev-1.pdf" has already been included
in the archive. Adding it the second time would cause
the first file to be overwritten during unarchiving, and
could also get the archive flagged as invalid.
# ./spec/features/transmittal_pages_spec.rb:1801:in `block (5 levels) in <top (required)>'
This the test spec:
describe "Download Zip File" do
before do
# Schedule transmittal first
login_as_user @user_root
visit transmittal_path @root_transmittal_filled
click_link I18n.t(:transmittal_schedule)
click_link I18n.t(:download_zip_file)
@tmp_transmittal = Transmittal.find(@root_transmittal_filled.id)
end
describe "Should give the correct file" do
specify {
response_headers['Content-Type'].should eq "application/zip"
response_headers['Content-Disposition'].should match @root_transmittal_filled.code
# check file name in the ZIP file (remove _1,_2,etc., implicating duplicate names)
Zip::CentralDirectory.read_from_stream(StringIO.new(page.body)).
map {|zf| zf.name.sub(/ \([0-9]+\)\.pdf/, '.pdf')}.sort.should eq(
@tmp_transmittal.transmittal_files.map{|tf| tf.file_asset.asset_file_name}.sort)
}
end
end # Download Zip File
The click_link I18n.t(:download_zip_file) initiates the following controller action:
# GET /transmittals/1/download
def download
Transmittal.transaction do
@transmittal.download_count += 1
@transmittal.save!
files = @transmittal.get_download_file_list
zipline( files, sanitize_filename( "#{@transmittal.code}.zip" ))
end
end
I am using the following versions:
zipline (1.2.1)
zip_tricks (5.3.1)
rubyzip (2.3.0)
I'm upgrading my project from Rails 4 to 5 (currently to 5.0.7.2) and I run my tests.
At a simply download in my test I get the following error (however the same functionality in the browser has no problem):
This the test spec:
The
click_link I18n.t(:download_zip_file)
initiates the following controller action:I am using the following versions: zipline (1.2.1) zip_tricks (5.3.1) rubyzip (2.3.0)