summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorFatih Acet <acetfatih@gmail.com>2016-07-20 18:57:01 +0000
committerRémy Coutable <remy@rymai.me>2016-07-21 11:20:16 +0200
commit7c0d00394af2e37c43eaf4e37e786aa3a12b3375 (patch)
tree0c710a8716baecccdf23b2551d26bd6a7665c515 /spec
parente31bf4360d31c023afc29d24eb8dfb86d8ee7b78 (diff)
downloadgitlab-ce-7c0d00394af2e37c43eaf4e37e786aa3a12b3375.tar.gz
Merge branch 'cs-warn-on-failure' into 'master'
Warn on failure ## What does this MR do? Adds styling and HTML for a `success_with_warnings` status in the MR widget. Unfinished as it needs some plumbing in the relevant CI controllers and models. ## Are there points in the code the reviewer needs to double check? Not at the moment, though I think I'll probably need help getting this to work in the backend. ## What are the relevant issue numbers? #17669 ## Screenshots (if relevant) ![Screen_Shot_2016-06-29_at_12.02.49_PM](/uploads/af4a915689633fe028f44bb34ae7a5b1/Screen_Shot_2016-06-29_at_12.02.49_PM.png) ## Does this MR meet the acceptance criteria? - [ ] [CHANGELOG](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CHANGELOG) entry added - [ ] [Documentation created/updated](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/development/doc_styleguide.md) - [ ] API support added - Tests - [ ] Added for this feature/bug - [ ] All builds are passing - [ ] Conform by the [style guides](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md#style-guides) - [ ] Branch has no merge conflicts with `master` (if you do - rebase it please) - [ ] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits) cc: @ayufan See merge request !5004
Diffstat (limited to 'spec')
-rw-r--r--spec/models/ci/pipeline_spec.rb38
1 files changed, 38 insertions, 0 deletions
diff --git a/spec/models/ci/pipeline_spec.rb b/spec/models/ci/pipeline_spec.rb
index a3bd8fdf30b..0d4c86955ce 100644
--- a/spec/models/ci/pipeline_spec.rb
+++ b/spec/models/ci/pipeline_spec.rb
@@ -504,4 +504,42 @@ describe Ci::Pipeline, models: true do
end
end
end
+
+ describe '#has_warnings?' do
+ subject { pipeline.has_warnings? }
+
+ context 'build which is allowed to fail fails' do
+ before do
+ create :ci_build, :success, pipeline: pipeline, name: 'rspec'
+ create :ci_build, :allowed_to_fail, :failed, pipeline: pipeline, name: 'rubocop'
+ end
+
+ it 'returns true' do
+ is_expected.to be_truthy
+ end
+ end
+
+ context 'build which is allowed to fail succeeds' do
+ before do
+ create :ci_build, :success, pipeline: pipeline, name: 'rspec'
+ create :ci_build, :allowed_to_fail, :success, pipeline: pipeline, name: 'rubocop'
+ end
+
+ it 'returns false' do
+ is_expected.to be_falsey
+ end
+ end
+
+ context 'build is retried and succeeds' do
+ before do
+ create :ci_build, :success, pipeline: pipeline, name: 'rubocop'
+ create :ci_build, :failed, pipeline: pipeline, name: 'rspec'
+ create :ci_build, :success, pipeline: pipeline, name: 'rspec'
+ end
+
+ it 'returns false' do
+ is_expected.to be_falsey
+ end
+ end
+ end
end