diff options
author | Connor Shea <connor.james.shea@gmail.com> | 2016-07-12 11:05:48 -0600 |
---|---|---|
committer | Connor Shea <connor.james.shea@gmail.com> | 2016-07-19 12:31:24 -0600 |
commit | b306a52114bb155538dcee3b0eab815ac8d2655d (patch) | |
tree | 53c6ca76ec0f14eb9d3790af244de9564b84be32 /spec | |
parent | f668a785cd7174b32e8070fde9cbb503caa04f8e (diff) | |
download | gitlab-ce-b306a52114bb155538dcee3b0eab815ac8d2655d.tar.gz |
Add with_warnings? method to Pipelines and add tests.
Diffstat (limited to 'spec')
-rw-r--r-- | spec/models/ci/pipeline_spec.rb | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/spec/models/ci/pipeline_spec.rb b/spec/models/ci/pipeline_spec.rb index c29e4811385..20520b0a111 100644 --- a/spec/models/ci/pipeline_spec.rb +++ b/spec/models/ci/pipeline_spec.rb @@ -502,4 +502,30 @@ describe Ci::Pipeline, models: true do end end end + + describe '#with_warnings?' do + subject { pipeline.with_warnings? } + + context 'build which is allowed to fail fails' do + before do + FactoryGirl.create :ci_build, :success, pipeline: pipeline, name: 'rspec' + FactoryGirl.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 + FactoryGirl.create :ci_build, :success, pipeline: pipeline, name: 'rspec' + FactoryGirl.create :ci_build, :allowed_to_fail, :success, pipeline: pipeline, name: 'rubocop' + end + + it 'returns false' do + is_expected.to be_falsey + end + end + end end |