summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-01-09 10:58:45 +0100
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-01-09 10:58:45 +0100
commit5456859b5b28baca95ced74179a349563498a5f0 (patch)
tree87d7e47fab78f3f9481cb09d443e38d8599c19ef /spec
parent4a7e1423f00adb7f11efc9d8342ae8236de56228 (diff)
downloadgitlab-ce-5456859b5b28baca95ced74179a349563498a5f0.tar.gz
Add method that checks for expiring build artifacts
Diffstat (limited to 'spec')
-rw-r--r--spec/features/projects/builds_spec.rb4
-rw-r--r--spec/models/build_spec.rb45
2 files changed, 34 insertions, 15 deletions
diff --git a/spec/features/projects/builds_spec.rb b/spec/features/projects/builds_spec.rb
index 984918e22f7..11d27feab0b 100644
--- a/spec/features/projects/builds_spec.rb
+++ b/spec/features/projects/builds_spec.rb
@@ -155,8 +155,8 @@ feature 'Builds', :feature do
click_link 'Keep'
- expect(page).not_to have_link 'Keep'
- expect(page).not_to have_content 'The artifacts will be removed'
+ expect(page).to have_no_link 'Keep'
+ expect(page).to have_no_content 'The artifacts will be removed'
end
end
diff --git a/spec/models/build_spec.rb b/spec/models/build_spec.rb
index cd3b6d51545..4d71c20f525 100644
--- a/spec/models/build_spec.rb
+++ b/spec/models/build_spec.rb
@@ -652,6 +652,24 @@ describe Ci::Build, models: true do
end
end
+ describe '#has_expiring_artifacts?' do
+ context 'when artifacts have expiration date set' do
+ before { build.update(artifacts_expire_at: 1.day.from_now) }
+
+ it 'has expiring artifacts' do
+ expect(build).to have_expiring_artifacts
+ end
+ end
+
+ context 'when artifacts do not have expiration date set' do
+ before { build.update(artifacts_expire_at: nil) }
+
+ it 'does not have expiring artifacts' do
+ expect(build).not_to have_expiring_artifacts
+ end
+ end
+ end
+
describe '#artifacts_metadata?' do
subject { build.artifacts_metadata? }
context 'artifacts metadata does not exist' do
@@ -663,19 +681,6 @@ describe Ci::Build, models: true do
it { is_expected.to be_truthy }
end
end
- describe '#repo_url' do
- let(:build) { create(:ci_build) }
- let(:project) { build.project }
-
- subject { build.repo_url }
-
- it { is_expected.to be_a(String) }
- it { is_expected.to end_with(".git") }
- it { is_expected.to start_with(project.web_url[0..6]) }
- it { is_expected.to include(build.token) }
- it { is_expected.to include('gitlab-ci-token') }
- it { is_expected.to include(project.web_url[7..-1]) }
- end
describe '#artifacts_expire_in' do
subject { build.artifacts_expire_in }
@@ -721,6 +726,20 @@ describe Ci::Build, models: true do
end
end
+ describe '#repo_url' do
+ let(:build) { create(:ci_build) }
+ let(:project) { build.project }
+
+ subject { build.repo_url }
+
+ it { is_expected.to be_a(String) }
+ it { is_expected.to end_with(".git") }
+ it { is_expected.to start_with(project.web_url[0..6]) }
+ it { is_expected.to include(build.token) }
+ it { is_expected.to include('gitlab-ci-token') }
+ it { is_expected.to include(project.web_url[7..-1]) }
+ end
+
describe '#depends_on_builds' do
let!(:build) { create(:ci_build, pipeline: pipeline, name: 'build', stage_idx: 0, stage: 'build') }
let!(:rspec_test) { create(:ci_build, pipeline: pipeline, name: 'rspec', stage_idx: 1, stage: 'test') }