2019-07-25 01:21:37 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-06-24 03:49:54 -04:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-06-24 14:09:03 -04:00
|
|
|
RSpec.describe Gitlab::Config::Entry::Boolean do
|
2016-06-24 03:49:54 -04:00
|
|
|
let(:entry) { described_class.new(config) }
|
|
|
|
|
|
|
|
describe 'validations' do
|
|
|
|
context 'when entry config value is valid' do
|
|
|
|
let(:config) { false }
|
|
|
|
|
|
|
|
describe '#value' do
|
|
|
|
it 'returns key value' do
|
|
|
|
expect(entry.value).to eq false
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
describe '#valid?' do
|
|
|
|
it 'is valid' do
|
|
|
|
expect(entry).to be_valid
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when entry value is not valid' do
|
2016-07-04 05:37:28 -04:00
|
|
|
let(:config) { ['incorrect'] }
|
2016-06-24 03:49:54 -04:00
|
|
|
|
|
|
|
describe '#errors' do
|
|
|
|
it 'saves errors' do
|
|
|
|
expect(entry.errors)
|
2016-06-29 03:39:04 -04:00
|
|
|
.to include 'boolean config should be a boolean value'
|
2016-06-24 03:49:54 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|