diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-06-21 11:47:05 +0200 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-06-21 11:47:05 +0200 |
commit | 8b550db33e27d95424de31acf20835cc731684a5 (patch) | |
tree | ac140a6b3a860929909b723dc6c01ad7fa5ff469 /spec | |
parent | c91298d554a2535e0a579e6255fd5640d171e6cf (diff) | |
download | gitlab-ce-8b550db33e27d95424de31acf20835cc731684a5.tar.gz |
Add image configuration entry to new ci config
Diffstat (limited to 'spec')
-rw-r--r-- | spec/lib/gitlab/ci/config/node/image_spec.rb | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/spec/lib/gitlab/ci/config/node/image_spec.rb b/spec/lib/gitlab/ci/config/node/image_spec.rb new file mode 100644 index 00000000000..0b0821ca558 --- /dev/null +++ b/spec/lib/gitlab/ci/config/node/image_spec.rb @@ -0,0 +1,46 @@ +require 'spec_helper' + +describe Gitlab::Ci::Config::Node::Image do + let(:entry) { described_class.new(config) } + + describe 'validation' do + context 'when entry config value is correct' do + let(:config) { 'ruby:2.2' } + + describe '#value' do + it 'returns image string' do + expect(entry.value).to eq 'ruby:2.2' + end + end + + describe '#errors' do + it 'does not append errors' do + expect(entry.errors).to be_empty + 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) { ['ruby:2.2'] } + + describe '#errors' do + it 'saves errors' do + expect(entry.errors) + .to include 'Image config should be a string' + end + end + + describe '#valid?' do + it 'is not valid' do + expect(entry).not_to be_valid + end + end + end + end +end |