spec/rake/funnel/tasks/zip_spec.rb in rake-funnel-0.0.4.pre vs spec/rake/funnel/tasks/zip_spec.rb in rake-funnel-0.0.5.pre
- old
+ new
@@ -56,20 +56,27 @@
end
context 'success' do
let(:finder) { double(Finder).as_null_object }
let(:zip) { double(::Zip::File).as_null_object }
+ let(:mtime) { Time.new(2015, 3, 9) }
+ let(:zip_entry) { double(::Zip::Entry).as_null_object }
before {
allow(finder).to receive(:all_or_default).and_return(source)
allow(Finder).to receive(:new).and_return(finder)
allow(RakeFileUtils).to receive(:mkdir_p)
allow(Rake).to receive(:rake_output_message)
allow(::Zip::File).to receive(:open).with(target, ::Zip::File::CREATE).and_yield(zip)
}
before {
+ allow(zip).to receive(:add).and_return(zip_entry)
+ allow(File).to receive(:mtime).and_return(mtime)
+ }
+
+ before {
Task[subject.name].invoke
}
it 'should create the target directory' do
expect(RakeFileUtils).to have_received(:mkdir_p).with(File.dirname(target))
@@ -109,9 +116,13 @@
files = build_args
files.each do |file_args|
expect(zip).to have_received(:add).with(*file_args)
end
+ end
+
+ it 'should explicitly set the file mtime to work around https://github.com/rubyzip/rubyzip/issues/176' do
+ expect(zip_entry).to have_received(:time=).with(mtime).exactly(build_args.length).times
end
end
end
end
end