diff options
author | Filip Krakowski <Filip.Krakowski@Uni-Duesseldorf.de> | 2017-06-01 11:58:34 +0200 |
---|---|---|
committer | Shinya Maeda <gitlab.shinyamaeda@gmail.com> | 2017-06-08 00:34:58 +0900 |
commit | 6c8e72b4108e5c671970a3965b214c8b1dda53ae (patch) | |
tree | 20ffdbf25e88bb1065f83039385accb78671e2d8 /spec | |
parent | 0601ac5d0b0330fb21228bef82650b3d3f6898cb (diff) | |
download | gitlab-ce-6c8e72b4108e5c671970a3965b214c8b1dda53ae.tar.gz |
Add 'schedules' keyword to 'only' and 'except'
Diffstat (limited to 'spec')
-rw-r--r-- | spec/lib/ci/gitlab_ci_yaml_processor_spec.rb | 44 |
1 files changed, 44 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 72b9cde10e7..83085f61b37 100644 --- a/spec/lib/ci/gitlab_ci_yaml_processor_spec.rb +++ b/spec/lib/ci/gitlab_ci_yaml_processor_spec.rb @@ -230,6 +230,17 @@ module Ci expect(config_processor.builds_for_stage_and_ref(type, "deploy", false, true).size).to eq(1) end + it "returns builds if only has a schedules keyword specified and a schedule is provided" do + config = YAML.dump({ + before_script: ["pwd"], + rspec: { script: "rspec", type: type, only: ["schedules"] } + }) + + config_processor = GitlabCiYamlProcessor.new(config, path) + + expect(config_processor.builds_for_stage_and_ref(type, "deploy", false, false, true).size).to eq(1) + end + it "does not return builds if only has a triggers keyword specified and no trigger is provided" do config = YAML.dump({ before_script: ["pwd"], @@ -241,6 +252,17 @@ module Ci expect(config_processor.builds_for_stage_and_ref(type, "deploy").size).to eq(0) end + it "does not return builds if only has a schedules keyword specified and no schedule is provided" do + config = YAML.dump({ + before_script: ["pwd"], + rspec: { script: "rspec", type: type, only: ["schedules"] } + }) + + config_processor = GitlabCiYamlProcessor.new(config, path) + + expect(config_processor.builds_for_stage_and_ref(type, "deploy").size).to eq(0) + end + it "returns builds if only has current repository path" do config = YAML.dump({ before_script: ["pwd"], @@ -386,6 +408,17 @@ module Ci expect(config_processor.builds_for_stage_and_ref(type, "deploy", false, true).size).to eq(0) end + it "does not return builds if except has a schedules keyword specified and a schedule is provided" do + config = YAML.dump({ + before_script: ["pwd"], + rspec: { script: "rspec", type: type, except: ["schedules"] } + }) + + config_processor = GitlabCiYamlProcessor.new(config, path) + + expect(config_processor.builds_for_stage_and_ref(type, "deploy", false, false, true).size).to eq(0) + end + it "returns builds if except has a triggers keyword specified and no trigger is provided" do config = YAML.dump({ before_script: ["pwd"], @@ -397,6 +430,17 @@ module Ci expect(config_processor.builds_for_stage_and_ref(type, "deploy").size).to eq(1) end + it "returns builds if except has a schedules keyword specified and no schedule is provided" do + config = YAML.dump({ + before_script: ["pwd"], + rspec: { script: "rspec", type: type, except: ["schedules"] } + }) + + config_processor = GitlabCiYamlProcessor.new(config, path) + + expect(config_processor.builds_for_stage_and_ref(type, "deploy").size).to eq(1) + end + it "does not return builds if except has current repository path" do config = YAML.dump({ before_script: ["pwd"], |