diff options
author | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-08-11 17:10:28 +0200 |
---|---|---|
committer | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-08-11 17:10:28 +0200 |
commit | 0b0a53ee5ec3782c6c7e166f69f190e820232fb0 (patch) | |
tree | b2cd0518594a933ec2c68c2f883026bb82da3569 /spec/models/build_spec.rb | |
parent | 0b52517049fc8ac01407018c8a6225d7788861a3 (diff) | |
parent | 4c29c25497c9a20a5d1f57cd287123cd41edad96 (diff) | |
download | gitlab-ce-0b0a53ee5ec3782c6c7e166f69f190e820232fb0.tar.gz |
Merge remote-tracking branch 'origin/master' into pipeline-hooks-without-slack
# Conflicts:
# app/models/ci/pipeline.rb
# app/services/ci/create_pipeline_service.rb
# spec/models/project_services/hipchat_service_spec.rb
Diffstat (limited to 'spec/models/build_spec.rb')
-rw-r--r-- | spec/models/build_spec.rb | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/spec/models/build_spec.rb b/spec/models/build_spec.rb index ba0242b071e..395316a8766 100644 --- a/spec/models/build_spec.rb +++ b/spec/models/build_spec.rb @@ -765,6 +765,53 @@ describe Ci::Build, models: true do end end + describe '#when' do + subject { build.when } + + context 'if is undefined' do + before do + build.when = nil + end + + context 'use from gitlab-ci.yml' do + before do + stub_ci_pipeline_yaml_file(config) + end + + context 'if config is not found' do + let(:config) { nil } + + it { is_expected.to eq('on_success') } + end + + context 'if config does not have a questioned job' do + let(:config) do + YAML.dump({ + test_other: { + script: 'Hello World' + } + }) + end + + it { is_expected.to eq('on_success') } + end + + context 'if config has when' do + let(:config) do + YAML.dump({ + test: { + script: 'Hello World', + when: 'always' + } + }) + end + + it { is_expected.to eq('always') } + end + end + end + end + describe '#retryable?' do context 'when build is running' do before do |