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
path: root/spec/lib/ci
diff options
context:
space:
mode:
authorKatarzyna Kobierska <kkobierska@gmail.com>2016-08-29 16:07:19 +0300
committerKatarzyna Kobierska <kkobierska@gmail.com>2016-09-07 13:10:49 +0300
commit2c8b830fdbf749e8bb7461d5c3ce4699b77ce3ca (patch)
tree10e0c44ca36349acf1378d3191267c9d1493b321 /spec/lib/ci
parentbbba62fa51419b14be4f39873afdd45b5b248764 (diff)
Code refactoring
Diffstat (limited to 'spec/lib/ci')
-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