summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/ci/gitlab_ci_yaml_processor.rb2
-rw-r--r--spec/lib/ci/gitlab_ci_yaml_processor_spec.rb5
-rw-r--r--spec/models/ci/commit_spec.rb4
3 files changed, 6 insertions, 5 deletions
diff --git a/lib/ci/gitlab_ci_yaml_processor.rb b/lib/ci/gitlab_ci_yaml_processor.rb
index 58be188387f..0da73e387e1 100644
--- a/lib/ci/gitlab_ci_yaml_processor.rb
+++ b/lib/ci/gitlab_ci_yaml_processor.rb
@@ -187,7 +187,7 @@ module Ci
end
if job[:when] && !job[:when].in?(%w(on_success on_failure always))
- raise ValidationError, "#{name}: when should be on_success, on_failure or always"
+ raise ValidationError, "#{name}: when parameter should be on_success, on_failure or always"
end
end
diff --git a/spec/lib/ci/gitlab_ci_yaml_processor_spec.rb b/spec/lib/ci/gitlab_ci_yaml_processor_spec.rb
index 65696cb1ed3..2260a6f8130 100644
--- a/spec/lib/ci/gitlab_ci_yaml_processor_spec.rb
+++ b/spec/lib/ci/gitlab_ci_yaml_processor_spec.rb
@@ -24,7 +24,8 @@ module Ci
commands: "pwd\nrspec",
tag_list: [],
options: {},
- allow_failure: false
+ allow_failure: false,
+ when: "on_success"
})
end
@@ -330,7 +331,7 @@ module Ci
end
it "returns errors if job when is not on_success, on_failure or always" do
- config = YAML.dump({ rspec: { script: "test", when: false } })
+ config = YAML.dump({ rspec: { script: "test", when: 1 } })
expect do
GitlabCiYamlProcessor.new(config)
end.to raise_error(GitlabCiYamlProcessor::ValidationError, "rspec job: when parameter should be on_success, on_failure or always")
diff --git a/spec/models/ci/commit_spec.rb b/spec/models/ci/commit_spec.rb
index 9ad30407769..94fc21b4ea9 100644
--- a/spec/models/ci/commit_spec.rb
+++ b/spec/models/ci/commit_spec.rb
@@ -248,7 +248,7 @@ describe Ci::Commit do
end
context 'properly creates builds "when" is defined' do
- let(:yaml) {
+ let(:yaml) do
{
stages: ["build", "test", "test_failure", "deploy", "cleanup"],
build: {
@@ -274,7 +274,7 @@ describe Ci::Commit do
when: "always",
}
}
- }
+ end
before do
stub_ci_commit_yaml_file(YAML.dump(yaml))