mirror of
https://github.com/wahyd4/gitlabhq.git
synced 2026-08-13 14:46:05 +10:00
This is a temporary refactoring stub, that is planned to be removed after removing legacy config processor.
48 lines
918 B
Ruby
48 lines
918 B
Ruby
require 'spec_helper'
|
|
|
|
describe Gitlab::Ci::Config do
|
|
let(:config) do
|
|
described_class.new(yml)
|
|
end
|
|
|
|
context 'when 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
|
|
|
|
context 'when config is invalid' do
|
|
let(:yml) { '// invalid' }
|
|
|
|
describe '.new' do
|
|
it 'raises error' do
|
|
expect { config }.to raise_error(
|
|
Gitlab::Ci::Config::Loader::FormatError,
|
|
/Invalid configuration format/
|
|
)
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|