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-05 14:35:50 +0300
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2016-07-05 14:35:50 +0300
commit5b7f211cbba06f7c43b55b4a38704073564a099f (patch)
treecf55127023e00e8a4cd4c32afbdae60df02949c2 /spec/lib/gitlab/ci
parent9686a4f2b2fd010b5a15409ba65ac4eed8e11c7b (diff)
Add new CI config entry that holds jobs definition
Diffstat (limited to 'spec/lib/gitlab/ci')
-rw-r--r--spec/lib/gitlab/ci/config/node/global_spec.rb4
-rw-r--r--spec/lib/gitlab/ci/config/node/jobs_spec.rb36
2 files changed, 38 insertions, 2 deletions
diff --git a/spec/lib/gitlab/ci/config/node/global_spec.rb b/spec/lib/gitlab/ci/config/node/global_spec.rb
index 88194bf9453..8f2f9e171d1 100644
--- a/spec/lib/gitlab/ci/config/node/global_spec.rb
+++ b/spec/lib/gitlab/ci/config/node/global_spec.rb
@@ -35,7 +35,7 @@ describe Gitlab::Ci::Config::Node::Global do
end
it 'creates node object for each entry' do
- expect(global.nodes.count).to eq 8
+ expect(global.nodes.count).to eq 9
end
it 'creates node object using valid class' do
@@ -139,7 +139,7 @@ describe Gitlab::Ci::Config::Node::Global do
describe '#nodes' do
it 'instantizes all nodes' do
- expect(global.nodes.count).to eq 8
+ expect(global.nodes.count).to eq 9
end
it 'contains undefined nodes' do
diff --git a/spec/lib/gitlab/ci/config/node/jobs_spec.rb b/spec/lib/gitlab/ci/config/node/jobs_spec.rb
new file mode 100644
index 00000000000..3afa3de06c6
--- /dev/null
+++ b/spec/lib/gitlab/ci/config/node/jobs_spec.rb
@@ -0,0 +1,36 @@
+require 'spec_helper'
+
+describe Gitlab::Ci::Config::Node::Jobs do
+ let(:entry) { described_class.new(config) }
+
+ describe 'validations' do
+ context 'when entry config value is correct' do
+ let(:config) { { rspec: { script: 'rspec' } } }
+
+ describe '#value' do
+ it 'returns key value' do
+ expect(entry.value).to eq(rspec: { script: 'rspec' })
+ 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
+ context 'incorrect config value type' do
+ let(:config) { ['incorrect'] }
+
+ describe '#errors' do
+ it 'saves errors' do
+ expect(entry.errors)
+ .to include 'jobs config should be a hash'
+ end
+ end
+ end
+ end
+ end
+end