2017-06-17 10:35:30 -04:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe Gitlab::FakeApplicationSettings do
|
2017-11-23 08:16:14 -05:00
|
|
|
let(:defaults) { { password_authentication_enabled_for_web: false, foobar: 'asdf', signup_enabled: true, 'test?' => 123 } }
|
2017-06-17 10:35:30 -04:00
|
|
|
|
|
|
|
subject { described_class.new(defaults) }
|
|
|
|
|
|
|
|
it 'wraps OpenStruct variables properly' do
|
2017-11-23 08:16:14 -05:00
|
|
|
expect(subject.password_authentication_enabled_for_web).to be_falsey
|
2017-06-17 10:35:30 -04:00
|
|
|
expect(subject.signup_enabled).to be_truthy
|
|
|
|
expect(subject.foobar).to eq('asdf')
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'defines predicate methods' do
|
2017-11-23 08:16:14 -05:00
|
|
|
expect(subject.password_authentication_enabled_for_web?).to be_falsey
|
2017-06-17 10:35:30 -04:00
|
|
|
expect(subject.signup_enabled?).to be_truthy
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'predicate method changes when value is updated' do
|
2017-11-23 08:16:14 -05:00
|
|
|
subject.password_authentication_enabled_for_web = true
|
2017-06-17 10:35:30 -04:00
|
|
|
|
2017-11-23 08:16:14 -05:00
|
|
|
expect(subject.password_authentication_enabled_for_web?).to be_truthy
|
2017-06-17 10:35:30 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'does not define a predicate method' do
|
|
|
|
expect(subject.foobar?).to be_nil
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'does not override an existing predicate method' do
|
|
|
|
expect(subject.test?).to eq(123)
|
|
|
|
end
|
|
|
|
end
|