diff options
author | Kamil Trzciński <ayufan@ayufan.eu> | 2019-07-04 16:04:29 +0300 |
---|---|---|
committer | Kamil Trzciński <ayufan@ayufan.eu> | 2019-07-04 16:04:29 +0300 |
commit | 56af0bfd9e4f1895d2060e1fcb9c0885d1f3b024 (patch) | |
tree | 96bd416f4937f26cea7c06728394d84f41c7cc81 /spec | |
parent | 7b315ed6cef6912ec61ad85fa391cf7a9b1ea78d (diff) | |
parent | 93be669e16b71a00362187a690e573209d80d960 (diff) |
Merge branch 'refactor-pipeline-errors_message-ce' into 'master'
CE Port: Refactor pipeline errors_message
See merge request gitlab-org/gitlab-ce!30116
Diffstat (limited to 'spec')
-rw-r--r-- | spec/models/ci/pipeline_spec.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/spec/models/ci/pipeline_spec.rb b/spec/models/ci/pipeline_spec.rb index 55cea48b641..e24bbc39761 100644 --- a/spec/models/ci/pipeline_spec.rb +++ b/spec/models/ci/pipeline_spec.rb @@ -2998,4 +2998,28 @@ describe Ci::Pipeline, :mailer do end end end + + describe '#error_messages' do + subject { pipeline.error_messages } + + before do + pipeline.valid? + end + + context 'when pipeline has errors' do + let(:pipeline) { build(:ci_pipeline, sha: nil, ref: nil) } + + it 'returns the full error messages' do + is_expected.to eq("Sha can't be blank and Ref can't be blank") + end + end + + context 'when pipeline does not have errors' do + let(:pipeline) { build(:ci_pipeline) } + + it 'returns empty string' do + is_expected.to be_empty + end + end + end end |