summaryrefslogtreecommitdiff
path: root/spec/lib
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2016-07-18 12:37:42 +0200
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2016-07-18 12:37:42 +0200
commit1bf9e34713b414f0e1ac8bbfe464a4cd5300581f (patch)
tree7bb7b1165563ad2515d41369ececf96a83b05f73 /spec/lib
parent27e88efceb9d59affebf93be040b0a9b0bf31b2f (diff)
downloadgitlab-ce-1bf9e34713b414f0e1ac8bbfe464a4cd5300581f.tar.gz
Move except and only job nodes to new CI config
Diffstat (limited to 'spec/lib')
-rw-r--r--spec/lib/ci/gitlab_ci_yaml_processor_spec.rb4
-rw-r--r--spec/lib/gitlab/ci/config/node/while_spec.rb56
2 files changed, 58 insertions, 2 deletions
diff --git a/spec/lib/ci/gitlab_ci_yaml_processor_spec.rb b/spec/lib/ci/gitlab_ci_yaml_processor_spec.rb
index 6e6898e758c..429ffd6ef35 100644
--- a/spec/lib/ci/gitlab_ci_yaml_processor_spec.rb
+++ b/spec/lib/ci/gitlab_ci_yaml_processor_spec.rb
@@ -163,7 +163,7 @@ module Ci
shared_examples 'raises an error' do
it do
- expect { processor }.to raise_error(GitlabCiYamlProcessor::ValidationError, 'rspec job: only parameter should be an array of strings or regexps')
+ expect { processor }.to raise_error(GitlabCiYamlProcessor::ValidationError, 'jobs:rspec:only config should be an array of strings or regexps')
end
end
@@ -319,7 +319,7 @@ module Ci
shared_examples 'raises an error' do
it do
- expect { processor }.to raise_error(GitlabCiYamlProcessor::ValidationError, 'rspec job: except parameter should be an array of strings or regexps')
+ expect { processor }.to raise_error(GitlabCiYamlProcessor::ValidationError, 'jobs:rspec:except config should be an array of strings or regexps')
end
end
diff --git a/spec/lib/gitlab/ci/config/node/while_spec.rb b/spec/lib/gitlab/ci/config/node/while_spec.rb
new file mode 100644
index 00000000000..aac2ed7b3db
--- /dev/null
+++ b/spec/lib/gitlab/ci/config/node/while_spec.rb
@@ -0,0 +1,56 @@
+require 'spec_helper'
+
+describe Gitlab::Ci::Config::Node::While do
+ let(:entry) { described_class.new(config) }
+
+ describe 'validations' do
+ context 'when entry config value is valid' do
+ context 'when config is a branch or tag name' do
+ let(:config) { %w[master feature/branch] }
+
+ describe '#valid?' do
+ it 'is valid' do
+ expect(entry).to be_valid
+ end
+ end
+
+ describe '#value' do
+ it 'returns key value' do
+ expect(entry.value).to eq config
+ end
+ end
+ end
+
+ context 'when config is a regexp' do
+ let(:config) { ['/^issue-.*$/'] }
+
+ describe '#valid?' do
+ it 'is valid' do
+ expect(entry).to be_valid
+ end
+ end
+ end
+
+ context 'when config is a special keyword' do
+ let(:config) { %w[tags triggers branches] }
+
+ describe '#valid?' do
+ it 'is valid' do
+ expect(entry).to be_valid
+ end
+ end
+ end
+ end
+
+ context 'when entry value is not valid' do
+ let(:config) { [1] }
+
+ describe '#errors' do
+ it 'saves errors' do
+ expect(entry.errors)
+ .to include 'while config should be an array of strings or regexps'
+ end
+ end
+ end
+ end
+end