Add new CI config entry for single job in pipeline

This commit is contained in:
Grzegorz Bizon 2016-07-05 14:04:22 +02:00
parent 5b7f211cbb
commit e00ae9a877
2 changed files with 50 additions and 0 deletions

View File

@ -0,0 +1,14 @@
module Gitlab
module Ci
class Config
module Node
##
# Entry that represents a concrete CI/CD job.
#
class Job < Entry
include Configurable
end
end
end
end
end

View File

@ -0,0 +1,36 @@
require 'spec_helper'
describe Gitlab::Ci::Config::Node::Job do
let(:entry) { described_class.new(config) }
describe 'validations' do
context 'when entry config value is correct' do
let(:config) { { script: 'rspec' } }
describe '#value' do
it 'returns key value' do
expect(entry.value).to eq(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 'job config should be a hash'
end
end
end
end
end
end