summaryrefslogtreecommitdiff
path: root/spec/lib/gitlab/ci/config_spec.rb
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2016-06-03 14:20:34 +0200
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2016-06-03 14:20:34 +0200
commitd501850e05ebadcbf2f957cbf35a0ffa6dbe31ff (patch)
tree7ce82a7b8f8d8f065d702ce67b8bca6fb015d166 /spec/lib/gitlab/ci/config_spec.rb
parent3f4ac2ff60c9d83ec65b19070e4d054e12e67dd2 (diff)
downloadgitlab-ce-d501850e05ebadcbf2f957cbf35a0ffa6dbe31ff.tar.gz
Add gitlab ci configuration class that holds hash
As for now, we keep this class inside a oryginal config processor class. We will move implementation to this class and delegate to it from current config processor. After original gitlab ci yaml processor not longer has relevant impelemntation we will replace it with new configuration class.
Diffstat (limited to 'spec/lib/gitlab/ci/config_spec.rb')
-rw-r--r--spec/lib/gitlab/ci/config_spec.rb34
1 files changed, 34 insertions, 0 deletions
diff --git a/spec/lib/gitlab/ci/config_spec.rb b/spec/lib/gitlab/ci/config_spec.rb
new file mode 100644
index 00000000000..6e251706714
--- /dev/null
+++ b/spec/lib/gitlab/ci/config_spec.rb
@@ -0,0 +1,34 @@
+require 'spec_helper'
+
+describe Gitlab::Ci::Config do
+ let(:config) do
+ described_class.new(yml)
+ end
+
+ context 'when yml config is valid' do
+ let(:yml) do
+ <<-EOS
+ image: ruby:2.2
+
+ rspec:
+ script:
+ - gem install rspec
+ - rspec
+ EOS
+ end
+
+ describe '#to_hash' do
+ it 'returns hash created from string' do
+ hash = {
+ image: 'ruby:2.2',
+ rspec: {
+ script: ['gem install rspec',
+ 'rspec']
+ }
+ }
+
+ expect(config.to_hash).to eq hash
+ end
+ end
+ end
+end