summaryrefslogtreecommitdiff
path: root/spec/lib/gitlab/ci/config/entry/stages_spec.rb
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2016-11-17 23:28:58 +0800
committerLin Jen-Shin <godfat@godfat.org>2016-11-17 23:28:58 +0800
commita8a879eebc805f27de9eb27fa05bce291ee931ff (patch)
treebc7054b990df703cbfa1fc4aac77e87be2359fe8 /spec/lib/gitlab/ci/config/entry/stages_spec.rb
parent48090a9188e13e3ddaffb5957a7b5a264024f060 (diff)
parentaea8baed3093c513560e9ac5ac0c5c99508d3001 (diff)
downloadgitlab-ce-a8a879eebc805f27de9eb27fa05bce291ee931ff.tar.gz
Merge remote-tracking branch 'upstream/master' into feature/1376-allow-write-access-deploy-keys
* upstream/master: (236 commits) Mention Git strategy none Remove ToC since it's now supported in the docs portal itself Add 8.14 to versions with further additions to review apps Add Limitations sections to environments and review apps docs Add link to environments docs Fix URL to review apps docs Add a prerequisites section, add some links Link to NGINX example project for the time being Get rid most of the irrelevant sections Add note about current limitation in $CI_BUILD_REF_NAME Add an intro and an Overview section for Review Apps WIP review apps Add Review apps link to CI README Add stop environment permissions and remove delete Add note about auto-stopping of environments Update CHANGELOG.md for 8.13.6 Finish "Stopping envs" and "Grouping similar envs" sections Highlight first user autocomplete option Remove ToC and fix headings in Markdown docs Revert "Merge branch '22680-unlabel-limit-autocomplete-to-selected-items' into 'master'" ...
Diffstat (limited to 'spec/lib/gitlab/ci/config/entry/stages_spec.rb')
-rw-r--r--spec/lib/gitlab/ci/config/entry/stages_spec.rb46
1 files changed, 46 insertions, 0 deletions
diff --git a/spec/lib/gitlab/ci/config/entry/stages_spec.rb b/spec/lib/gitlab/ci/config/entry/stages_spec.rb
new file mode 100644
index 00000000000..182c8d867c7
--- /dev/null
+++ b/spec/lib/gitlab/ci/config/entry/stages_spec.rb
@@ -0,0 +1,46 @@
+require 'spec_helper'
+
+describe Gitlab::Ci::Config::Entry::Stages do
+ let(:entry) { described_class.new(config) }
+
+ describe 'validations' do
+ context 'when entry config value is correct' do
+ let(:config) { [:stage1, :stage2] }
+
+ describe '#value' do
+ it 'returns array of stages' do
+ expect(entry.value).to eq config
+ end
+ end
+
+ describe '#valid?' do
+ it 'is valid' do
+ expect(entry).to be_valid
+ end
+ end
+ end
+
+ context 'when entry value is not correct' do
+ let(:config) { { test: true } }
+
+ describe '#errors' do
+ it 'saves errors' do
+ expect(entry.errors)
+ .to include 'stages config should be an array of strings'
+ end
+ end
+
+ describe '#valid?' do
+ it 'is not valid' do
+ expect(entry).not_to be_valid
+ end
+ end
+ end
+ end
+
+ describe '.default' do
+ it 'returns default stages' do
+ expect(described_class.default).to eq %w[build test deploy]
+ end
+ end
+end