diff options
author | Jason Roehm <jasonr@3db-labs.com> | 2016-03-15 09:35:38 -0400 |
---|---|---|
committer | Jason Roehm <jasonr@3db-labs.com> | 2016-03-15 09:35:38 -0400 |
commit | 6c1badbd108a12d1217596a3319f9bd3ca7319b8 (patch) | |
tree | a6ffaa6e28fb30f934bf0edbcd2e5d7bd017ca29 /spec | |
parent | a8f1c5ed03dff11a59a87a25ba2bde837963bb00 (diff) | |
download | gitlab-ce-6c1badbd108a12d1217596a3319f9bd3ca7319b8.tar.gz |
add tests for only/except 'triggers' keyword
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 fab6412d29f..b79b8147ce0 100644 --- a/spec/lib/ci/gitlab_ci_yaml_processor_spec.rb +++ b/spec/lib/ci/gitlab_ci_yaml_processor_spec.rb @@ -97,6 +97,28 @@ module Ci expect(config_processor.builds_for_stage_and_ref(type, "deploy").size).to eq(0) end + it "returns builds if only has a triggers keyword specified and a trigger is provided" do + config = YAML.dump({ + before_script: ["pwd"], + rspec: { script: "rspec", type: type, only: ["triggers"] } + }) + + config_processor = GitlabCiYamlProcessor.new(config, path) + + expect(config_processor.builds_for_stage_and_ref(type, "deploy", 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"], + rspec: { script: "rspec", type: type, only: ["triggers"] } + }) + + 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"], @@ -203,6 +225,28 @@ module Ci expect(config_processor.builds_for_stage_and_ref(type, "deploy").size).to eq(1) end + it "does not return builds if except has a triggers keyword specified and a trigger is provided" do + config = YAML.dump({ + before_script: ["pwd"], + rspec: { script: "rspec", type: type, except: ["triggers"] } + }) + + config_processor = GitlabCiYamlProcessor.new(config, path) + + expect(config_processor.builds_for_stage_and_ref(type, "deploy", 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"], + rspec: { script: "rspec", type: type, except: ["triggers"] } + }) + + 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"], |