Commit 3714e191 authored by Kamil Trzcinski's avatar Kamil Trzcinski

Improve after review

parent e6209a40
...@@ -670,7 +670,7 @@ failure. ...@@ -670,7 +670,7 @@ failure.
**Example configurations** **Example configurations**
To upload artifacts only when build fails To upload artifacts only when build fails.
```yaml ```yaml
job: job:
......
...@@ -208,7 +208,7 @@ module Ci ...@@ -208,7 +208,7 @@ module Ci
raise ValidationError, "#{name} job: allow_failure parameter should be an boolean" raise ValidationError, "#{name} job: allow_failure parameter should be an boolean"
end end
if job[:when] && !job[:when].in?(%w(on_success on_failure always)) if job[:when] && !job[:when].in?(%w[on_success on_failure always])
raise ValidationError, "#{name} job: when parameter should be on_success, on_failure or always" raise ValidationError, "#{name} job: when parameter should be on_success, on_failure or always"
end end
end end
...@@ -279,7 +279,7 @@ module Ci ...@@ -279,7 +279,7 @@ module Ci
raise ValidationError, "#{name} job: artifacts:paths parameter should be an array of strings" raise ValidationError, "#{name} job: artifacts:paths parameter should be an array of strings"
end end
if job[:artifacts][:when] && !job[:artifacts][:when].in?(%w(on_success on_failure always)) if job[:artifacts][:when] && !job[:artifacts][:when].in?(%w[on_success on_failure always])
raise ValidationError, "#{name} job: artifacts:when parameter should be on_success, on_failure or always" raise ValidationError, "#{name} job: artifacts:when parameter should be on_success, on_failure or always"
end end
end end
......
...@@ -602,7 +602,7 @@ module Ci ...@@ -602,7 +602,7 @@ module Ci
}) })
end end
%w(on_success on_failure always).each do |when_state| %w[on_success on_failure always].each do |when_state|
it "returns artifacts for when #{when_state} defined" do it "returns artifacts for when #{when_state} defined" do
config = YAML.dump({ config = YAML.dump({
rspec: { rspec: {
...@@ -612,6 +612,7 @@ module Ci ...@@ -612,6 +612,7 @@ module Ci
}) })
config_processor = GitlabCiYamlProcessor.new(config, path) config_processor = GitlabCiYamlProcessor.new(config, path)
builds = config_processor.builds_for_stage_and_ref("test", "master") builds = config_processor.builds_for_stage_and_ref("test", "master")
expect(builds.size).to eq(1) expect(builds.size).to eq(1)
expect(builds.first[:options][:artifacts][:when]).to eq(when_state) expect(builds.first[:options][:artifacts][:when]).to eq(when_state)
......
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