diff --git a/libraries/sevenzip_command_builder.rb b/libraries/sevenzip_command_builder.rb index 3f2fea11..841dfc0d 100644 --- a/libraries/sevenzip_command_builder.rb +++ b/libraries/sevenzip_command_builder.rb @@ -22,8 +22,7 @@ def initialize(resource) def sevenzip_command if resource.strip_components <= 0 - sevenzip_command_builder(resource.path, 'x') - return + return sevenzip_command_builder(resource.path, 'x') end tmpdir = make_temp_directory diff --git a/spec/libraries/sevenzip_command_builder_spec.rb b/spec/libraries/sevenzip_command_builder_spec.rb index d8fa5b2e..b426c131 100644 --- a/spec/libraries/sevenzip_command_builder_spec.rb +++ b/spec/libraries/sevenzip_command_builder_spec.rb @@ -40,4 +40,14 @@ expect(subject.cherry_pick).to eq(expected_command) end end + + context 'strip_components == 0' do + describe '#unpack' do + it 'generates the correct command' do + allow(resource).to receive(:strip_components).and_return(0) + expected_command = '"C:\\Program Files\\7-zip\\7z.exe" x "release_file" -so | "C:\\Program Files\\7-zip\\7z.exe" x -aoa -si -ttar -o"path" -uy' + expect(subject.unpack).to eq(expected_command) + end + end + end end