2019-11-08 03:06:48 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-06-17 14:35:30 +00:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe Gitlab::FakeApplicationSettings do
|
2019-03-14 14:15:44 +00:00
|
|
|
let(:defaults) do
|
|
|
|
described_class.defaults.merge(
|
|
|
|
foobar: 'asdf',
|
|
|
|
'test?' => 123
|
|
|
|
)
|
|
|
|
end
|
2017-06-17 14:35:30 +00:00
|
|
|
|
2019-03-14 14:15:44 +00:00
|
|
|
let(:setting) { described_class.new(defaults) }
|
2017-06-17 14:35:30 +00:00
|
|
|
|
|
|
|
it 'wraps OpenStruct variables properly' do
|
2019-03-14 14:15:44 +00:00
|
|
|
expect(setting.password_authentication_enabled_for_web).to be_truthy
|
|
|
|
expect(setting.signup_enabled).to be_truthy
|
|
|
|
expect(setting.foobar).to eq('asdf')
|
2017-06-17 14:35:30 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'defines predicate methods' do
|
2019-03-14 14:15:44 +00:00
|
|
|
expect(setting.password_authentication_enabled_for_web?).to be_truthy
|
|
|
|
expect(setting.signup_enabled?).to be_truthy
|
2017-06-17 14:35:30 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'does not define a predicate method' do
|
2019-03-14 14:15:44 +00:00
|
|
|
expect(setting.foobar?).to be_nil
|
2017-06-17 14:35:30 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'does not override an existing predicate method' do
|
2019-03-14 14:15:44 +00:00
|
|
|
expect(setting.test?).to eq(123)
|
2017-06-17 14:35:30 +00:00
|
|
|
end
|
2019-03-11 13:29:11 +00:00
|
|
|
|
2019-03-14 14:15:44 +00:00
|
|
|
it_behaves_like 'application settings examples'
|
2017-06-17 14:35:30 +00:00
|
|
|
end
|