summaryrefslogtreecommitdiff
path: root/spec/models
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2015-12-28 12:06:27 +0100
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2016-01-14 12:48:14 +0100
commit5ff7ec42dc8759717c485478261128d61ea70b9a (patch)
tree68a30bc4a0b967de057d0f5e7160cce3d38b1e90 /spec/models
parent8eeed761a9c25ea8ccfc347fbd3f5894b5957d9e (diff)
downloadgitlab-ce-5ff7ec42dc8759717c485478261128d61ea70b9a.tar.gz
Add method that checks if artifacts browser is supported
This is needed because of backward compatibility. Previously artifacts archive had `.tar.gz` format, but artifacts browser requires ZIP format now.
Diffstat (limited to 'spec/models')
-rw-r--r--spec/models/build_spec.rb23
1 files changed, 23 insertions, 0 deletions
diff --git a/spec/models/build_spec.rb b/spec/models/build_spec.rb
index 33e0eb7d5d7..108d7d5ff01 100644
--- a/spec/models/build_spec.rb
+++ b/spec/models/build_spec.rb
@@ -391,6 +391,29 @@ describe Ci::Build, models: true do
end
end
+
+ describe :artifacts_browser_supported? do
+ subject { build.artifacts_browser_supported? }
+ before do
+ file = fixture_file_upload(archive_file, archive_type)
+ build.update_attributes(artifacts_file: file)
+ end
+
+ context 'artifacts archive is not a zip file' do
+ let(:archive_file) { Rails.root + 'spec/fixtures/banana_sample.gif' }
+ let(:archive_type) { 'image/gif' }
+
+ it { is_expected.to be_falsy }
+ end
+
+ context 'artifacts archive is a zip file' do
+ let(:archive_file) { Rails.root + 'spec/fixtures/ci_build_artifacts.zip' }
+ let(:archive_type) { 'application/zip' }
+
+ it { is_expected.to be_truthy }
+ end
+ end
+
describe :repo_url do
let(:build) { FactoryGirl.create :ci_build }
let(:project) { build.project }