Commit 6c1badbd authored by Jason Roehm's avatar Jason Roehm

add tests for only/except 'triggers' keyword

parent a8f1c5ed
...@@ -97,6 +97,28 @@ module Ci ...@@ -97,6 +97,28 @@ module Ci
expect(config_processor.builds_for_stage_and_ref(type, "deploy").size).to eq(0) expect(config_processor.builds_for_stage_and_ref(type, "deploy").size).to eq(0)
end 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 it "returns builds if only has current repository path" do
config = YAML.dump({ config = YAML.dump({
before_script: ["pwd"], before_script: ["pwd"],
...@@ -203,6 +225,28 @@ module Ci ...@@ -203,6 +225,28 @@ module Ci
expect(config_processor.builds_for_stage_and_ref(type, "deploy").size).to eq(1) expect(config_processor.builds_for_stage_and_ref(type, "deploy").size).to eq(1)
end 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 it "does not return builds if except has current repository path" do
config = YAML.dump({ config = YAML.dump({
before_script: ["pwd"], before_script: ["pwd"],
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment