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