Commit 89b18120 authored by Grzegorz Bizon's avatar Grzegorz Bizon Committed by Grzegorz Bizon

Use build artifacts trait in build specs

parent 5e1edd37
...@@ -346,15 +346,14 @@ describe Ci::Build, models: true do ...@@ -346,15 +346,14 @@ describe Ci::Build, models: true do
describe :artifacts_download_url do describe :artifacts_download_url do
subject { build.artifacts_download_url } subject { build.artifacts_download_url }
it "should be nil if artifact doesn't exist" do context 'artifacts file does not exist' do
build.update_attributes(artifacts_file: nil) before { build.update_attributes(artifacts_file: nil) }
is_expected.to be_nil it { is_expected.to be_nil }
end end
it 'should not be nil if artifact exist' do context 'artifacts file exists' do
gif = fixture_file_upload(Rails.root + 'spec/fixtures/banana_sample.gif', 'image/gif') let(:build) { create(:ci_build, :artifacts) }
build.update_attributes(artifacts_file: gif) it { is_expected.to_not be_nil }
is_expected.to_not be_nil
end end
end end
...@@ -381,11 +380,7 @@ describe Ci::Build, models: true do ...@@ -381,11 +380,7 @@ describe Ci::Build, models: true do
end end
context 'artifacts archive exists' do context 'artifacts archive exists' do
before do let(:build) { create(:ci_build, :artifacts) }
gif = fixture_file_upload(Rails.root + 'spec/fixtures/banana_sample.gif', 'image/gif')
build.update_attributes(artifacts_file: gif)
end
it { is_expected.to be_truthy } it { is_expected.to be_truthy }
end end
end end
...@@ -398,16 +393,7 @@ describe Ci::Build, models: true do ...@@ -398,16 +393,7 @@ describe Ci::Build, models: true do
end end
context 'artifacts archive is a zip file and metadata exists' do context 'artifacts archive is a zip file and metadata exists' do
before do let(:build) { create(:ci_build, :artifacts) }
fixture_dir = Rails.root + 'spec/fixtures/'
archive = fixture_file_upload(fixture_dir + 'ci_build_artifacts.zip',
'application/zip')
metadata = fixture_file_upload(fixture_dir + 'ci_build_artifacts_metadata.gz',
'application/x-gzip')
build.update_attributes(artifacts_file: archive)
build.update_attributes(artifacts_metadata: metadata)
end
it { is_expected.to be_truthy } it { is_expected.to be_truthy }
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment