2019-12-26 22:10:19 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe Gitlab::FakeApplicationSettings do
|
2019-07-07 11:18:12 +05:30
|
|
|
let(:defaults) do
|
|
|
|
described_class.defaults.merge(
|
|
|
|
foobar: 'asdf',
|
|
|
|
'test?' => 123
|
|
|
|
)
|
|
|
|
end
|
2017-09-10 17:25:29 +05:30
|
|
|
|
2019-07-07 11:18:12 +05:30
|
|
|
let(:setting) { described_class.new(defaults) }
|
2017-09-10 17:25:29 +05:30
|
|
|
|
|
|
|
it 'wraps OpenStruct variables properly' do
|
2019-07-07 11:18:12 +05:30
|
|
|
expect(setting.password_authentication_enabled_for_web).to be_truthy
|
|
|
|
expect(setting.signup_enabled).to be_truthy
|
|
|
|
expect(setting.foobar).to eq('asdf')
|
2017-09-10 17:25:29 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
it 'defines predicate methods' do
|
2019-07-07 11:18:12 +05:30
|
|
|
expect(setting.password_authentication_enabled_for_web?).to be_truthy
|
|
|
|
expect(setting.signup_enabled?).to be_truthy
|
2017-09-10 17:25:29 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
it 'does not define a predicate method' do
|
2019-07-07 11:18:12 +05:30
|
|
|
expect(setting.foobar?).to be_nil
|
2017-09-10 17:25:29 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
it 'does not override an existing predicate method' do
|
2019-07-07 11:18:12 +05:30
|
|
|
expect(setting.test?).to eq(123)
|
2017-09-10 17:25:29 +05:30
|
|
|
end
|
2019-07-07 11:18:12 +05:30
|
|
|
|
|
|
|
it_behaves_like 'application settings examples'
|
2017-09-10 17:25:29 +05:30
|
|
|
end
|