Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/lib/ci/gitlab_ci_yaml_processor_spec.rb')
-rw-r--r--spec/lib/ci/gitlab_ci_yaml_processor_spec.rb27
1 files changed, 20 insertions, 7 deletions
diff --git a/spec/lib/ci/gitlab_ci_yaml_processor_spec.rb b/spec/lib/ci/gitlab_ci_yaml_processor_spec.rb
index d3a37ba6eb5..21aca9ee39f 100644
--- a/spec/lib/ci/gitlab_ci_yaml_processor_spec.rb
+++ b/spec/lib/ci/gitlab_ci_yaml_processor_spec.rb
@@ -1252,20 +1252,33 @@ EOT
end
describe "#errors" do
- describe "Error handling" do
- it "returns an error if the YAML could not be parsed" do
+ context "when the YAML could not be parsed" do
+ it "returns an error about invalid configutaion" do
content = YAML.dump("invalid: yaml: test")
- expect(GitlabCiYamlProcessor.errors(content)).to eq "Invalid configuration format"
+
+ expect(GitlabCiYamlProcessor.validation_message(content)).to eq "Invalid configuration format"
end
+ end
- it "returns an error if the tags parameter is invalid" do
+ context "when the tags parameter is invalid" do
+ it "returns an error about invalid tags" do
content = YAML.dump({ rspec: { script: "test", tags: "mysql" } })
- expect(GitlabCiYamlProcessor.errors(content)).to eq "jobs:rspec tags should be an array of strings"
+
+ expect(GitlabCiYamlProcessor.validation_message(content)).to eq "jobs:rspec tags should be an array of strings"
+ end
+ end
+
+ context "when YMAL content is empty" do
+ it "returns an error about missing content" do
+ expect(GitlabCiYamlProcessor.validation_message('')).to eq "Please provide content of .gitlab-ci.yml"
end
+ end
- it "does not return any errors when the YAML is valid" do
+ context "when the YAML is valid" do
+ it "does not return any errors" do
content = File.read(Rails.root.join('spec/support/gitlab_stubs/gitlab_ci.yml'))
- expect(GitlabCiYamlProcessor.errors(content)).to eq nil
+
+ expect(GitlabCiYamlProcessor.validation_message(content)).to be_nil
end
end
end