spec/dockly/util/git_spec.rb in dockly-3.0.3 vs spec/dockly/util/git_spec.rb in dockly-3.0.4
- old
+ new
@@ -26,13 +26,25 @@
let(:reader) { Gem::Package::TarReader.new(io.tap(&:rewind)) }
it 'archives the current directory into the given IO' do
subject.archive(subject.sha, prefix, io)
reader.each do |entry|
- expect(entry.full_name).to start_with(prefix)
- orig = entry.full_name.gsub(/\A#{prefix}\//, '')
- expect(File.exist?(orig)).to be_true
- expect(entry.read).to eq(File.read(orig)) if orig.end_with?('.rb')
+ if entry.full_name == 'pax_global_header'
+ expect(entry.header.typeflag).to eq('g')
+ else
+ expect(entry.full_name).to start_with(prefix)
+ orig = entry.full_name.gsub(/\A#{prefix}/, '.')
+ expect(File.exist?(orig)).to be_true
+ expect(entry.read).to eq(File.read(orig)) if orig.end_with?('.rb')
+ end
+ end
+ end
+
+ context 'with a really long prefix' do
+ let(:prefix) { '/' + ('a' * 255) }
+ it 'exhibits the tar extended headers' do
+ subject.archive(subject.sha, prefix, io)
+ expect(io.string.include?("path=#{prefix}")).to be true
end
end
end
end