2016-06-24 02:58:09 -04:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2016-11-14 04:31:45 -05:00
|
|
|
describe Gitlab::Ci::Config::Entry::Key do
|
2016-06-24 02:58:09 -04:00
|
|
|
let(:entry) { described_class.new(config) }
|
|
|
|
|
|
|
|
describe 'validations' do
|
|
|
|
context 'when entry config value is correct' do
|
|
|
|
let(:config) { 'test' }
|
|
|
|
|
|
|
|
describe '#value' do
|
|
|
|
it 'returns key value' do
|
|
|
|
expect(entry.value).to eq 'test'
|
|
|
|
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
|
2017-02-21 18:33:53 -05:00
|
|
|
let(:config) { ['incorrect'] }
|
2016-06-24 02:58:09 -04:00
|
|
|
|
|
|
|
describe '#errors' do
|
|
|
|
it 'saves errors' do
|
2017-02-22 17:54:59 -05:00
|
|
|
expect(entry.errors)
|
|
|
|
.to include 'key config should be a string or symbol'
|
2016-06-24 02:58:09 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|