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:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2016-07-18 13:37:42 +0300
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2016-07-18 13:37:42 +0300
commit1bf9e34713b414f0e1ac8bbfe464a4cd5300581f (patch)
tree7bb7b1165563ad2515d41369ececf96a83b05f73 /spec/lib/gitlab/ci/config
parent27e88efceb9d59affebf93be040b0a9b0bf31b2f (diff)
Move except and only job nodes to new CI config
Diffstat (limited to 'spec/lib/gitlab/ci/config')
-rw-r--r--spec/lib/gitlab/ci/config/node/while_spec.rb56
1 files changed, 56 insertions, 0 deletions
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