diff options
author | Grzegorz Bizon <grzegorz.bizon@ntsn.pl> | 2016-02-01 11:31:33 +0100 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-02-19 17:24:03 +0100 |
commit | 89b181204c9f8d05761463bbf0f5cb1a6be24611 (patch) | |
tree | 666d6c24ef9aaa3ea0476fc78efd72d7760107a4 /spec/models/build_spec.rb | |
parent | 5e1edd372f2522866805093d04b7127661083647 (diff) | |
download | gitlab-ce-89b181204c9f8d05761463bbf0f5cb1a6be24611.tar.gz |
Use build artifacts trait in build specs
Diffstat (limited to 'spec/models/build_spec.rb')
-rw-r--r-- | spec/models/build_spec.rb | 30 |
1 files changed, 8 insertions, 22 deletions
diff --git a/spec/models/build_spec.rb b/spec/models/build_spec.rb index 0acf6e6588a..a0cf5cfacc4 100644 --- a/spec/models/build_spec.rb +++ b/spec/models/build_spec.rb @@ -346,15 +346,14 @@ describe Ci::Build, models: true do describe :artifacts_download_url do subject { build.artifacts_download_url } - it "should be nil if artifact doesn't exist" do - build.update_attributes(artifacts_file: nil) - is_expected.to be_nil + context 'artifacts file does not exist' do + before { build.update_attributes(artifacts_file: nil) } + it { is_expected.to be_nil } end - it 'should not be nil if artifact exist' do - gif = fixture_file_upload(Rails.root + 'spec/fixtures/banana_sample.gif', 'image/gif') - build.update_attributes(artifacts_file: gif) - is_expected.to_not be_nil + context 'artifacts file exists' do + let(:build) { create(:ci_build, :artifacts) } + it { is_expected.to_not be_nil } end end @@ -381,11 +380,7 @@ describe Ci::Build, models: true do end context 'artifacts archive exists' do - before do - gif = fixture_file_upload(Rails.root + 'spec/fixtures/banana_sample.gif', 'image/gif') - build.update_attributes(artifacts_file: gif) - end - + let(:build) { create(:ci_build, :artifacts) } it { is_expected.to be_truthy } end end @@ -398,16 +393,7 @@ describe Ci::Build, models: true do end context 'artifacts archive is a zip file and metadata exists' do - before do - 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 - + let(:build) { create(:ci_build, :artifacts) } it { is_expected.to be_truthy } end end |