diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-06-16 21:25:58 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-06-16 21:25:58 +0300 |
commit | a5f4bba440d7f9ea47046a0a561d49adf0a1e6d4 (patch) | |
tree | fb69158581673816a8cd895f9d352dcb3c678b1e /spec/lib/gitlab/import_export/command_line_util_spec.rb | |
parent | d16b2e8639e99961de6ddc93909f3bb5c1445ba1 (diff) |
Add latest changes from gitlab-org/gitlab@14-0-stable-eev14.0.0-rc42
Diffstat (limited to 'spec/lib/gitlab/import_export/command_line_util_spec.rb')
-rw-r--r-- | spec/lib/gitlab/import_export/command_line_util_spec.rb | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/spec/lib/gitlab/import_export/command_line_util_spec.rb b/spec/lib/gitlab/import_export/command_line_util_spec.rb index 4000e303816..39a10f87083 100644 --- a/spec/lib/gitlab/import_export/command_line_util_spec.rb +++ b/spec/lib/gitlab/import_export/command_line_util_spec.rb @@ -42,6 +42,8 @@ RSpec.describe Gitlab::ImportExport::CommandLineUtil do filename = File.basename(tempfile.path) subject.gzip(dir: path, filename: filename) + + expect(File.exist?("#{tempfile.path}.gz")).to eq(true) end context 'when exception occurs' do @@ -50,4 +52,25 @@ RSpec.describe Gitlab::ImportExport::CommandLineUtil do end end end + + describe '#gunzip' do + it 'decompresses specified file' do + tmpdir = Dir.mktmpdir + filename = 'labels.ndjson.gz' + gz_filepath = "spec/fixtures/bulk_imports/gz/#{filename}" + FileUtils.copy_file(gz_filepath, File.join(tmpdir, filename)) + + subject.gunzip(dir: tmpdir, filename: filename) + + expect(File.exist?(File.join(tmpdir, 'labels.ndjson'))).to eq(true) + + FileUtils.remove_entry(tmpdir) + end + + context 'when exception occurs' do + it 'raises an exception' do + expect { subject.gunzip(dir: path, filename: 'test') }.to raise_error(Gitlab::ImportExport::Error) + end + end + end end |