diff options
author | Shinya Maeda <gitlab.shinyamaeda@gmail.com> | 2017-06-08 00:34:46 +0900 |
---|---|---|
committer | Shinya Maeda <gitlab.shinyamaeda@gmail.com> | 2017-06-08 00:34:59 +0900 |
commit | ecd9c30930f4391b5cdfa631b8920d660c750058 (patch) | |
tree | 3a3f98181829071647b040d38d71a7b63cb6e3d1 | |
parent | 32bfa48ad0b2d930d3a95656774982afed7489f0 (diff) | |
download | gitlab-ce-ecd9c30930f4391b5cdfa631b8920d660c750058.tar.gz |
Add source policy spec
-rw-r--r-- | spec/lib/ci/gitlab_ci_yaml_processor_spec.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/spec/lib/ci/gitlab_ci_yaml_processor_spec.rb b/spec/lib/ci/gitlab_ci_yaml_processor_spec.rb index 2a3196616fa..2ca0773ad1d 100644 --- a/spec/lib/ci/gitlab_ci_yaml_processor_spec.rb +++ b/spec/lib/ci/gitlab_ci_yaml_processor_spec.rb @@ -123,6 +123,25 @@ module Ci expect(seeds.first.builds.dig(0, :name)).to eq 'spinach' end end + + context 'when source policy is specified' do + let(:config) do + YAML.dump(production: { stage: 'deploy', script: 'cap prod', only: ['triggers'] }, + spinach: { stage: 'test', script: 'spinach', only: ['schedules'] }) + end + + let(:pipeline) do + create(:ci_empty_pipeline, source: :schedule) + end + + it 'returns stage seeds only assigned to schedules' do + seeds = subject.stage_seeds(pipeline) + + expect(seeds.size).to eq 1 + expect(seeds.first.stage[:name]).to eq 'test' + expect(seeds.first.builds.dig(0, :name)).to eq 'spinach' + end + end end describe "#builds_for_ref" do |