debian-mirror-gitlab/spec/lib/gitlab/ci/config/entry/services_spec.rb

36 lines
793 B
Ruby
Raw Normal View History

2016-08-24 12:49:21 +05:30
require 'spec_helper'
2017-08-17 22:00:37 +05:30
describe Gitlab::Ci::Config::Entry::Services do
2016-08-24 12:49:21 +05:30
let(:entry) { described_class.new(config) }
2017-09-10 17:25:29 +05:30
before do
entry.compose!
end
2016-08-24 12:49:21 +05:30
2017-09-10 17:25:29 +05:30
context 'when configuration is valid' do
let(:config) { ['postgresql:9.5', { name: 'postgresql:9.1', alias: 'postgres_old' }] }
2016-08-24 12:49:21 +05:30
2017-09-10 17:25:29 +05:30
describe '#valid?' do
it 'is valid' do
expect(entry).to be_valid
2016-08-24 12:49:21 +05:30
end
end
2017-09-10 17:25:29 +05:30
describe '#value' do
it 'returns valid array' do
expect(entry.value).to eq([{ name: 'postgresql:9.5' }, { name: 'postgresql:9.1', alias: 'postgres_old' }])
2016-08-24 12:49:21 +05:30
end
2017-09-10 17:25:29 +05:30
end
end
context 'when configuration is invalid' do
let(:config) { 'postgresql:9.5' }
2016-08-24 12:49:21 +05:30
2017-09-10 17:25:29 +05:30
describe '#valid?' do
it 'is invalid' do
expect(entry).not_to be_valid
2016-08-24 12:49:21 +05:30
end
end
end
end