debian-mirror-gitlab/spec/lib/gitlab/fake_application_settings_spec.rb

33 lines
1,012 B
Ruby
Raw Normal View History

2017-09-10 17:25:29 +05:30
require 'spec_helper'
describe Gitlab::FakeApplicationSettings do
2018-03-17 18:26:18 +05:30
let(:defaults) { { password_authentication_enabled_for_web: false, foobar: 'asdf', signup_enabled: true, 'test?' => 123 } }
2017-09-10 17:25:29 +05:30
subject { described_class.new(defaults) }
it 'wraps OpenStruct variables properly' do
2018-03-17 18:26:18 +05:30
expect(subject.password_authentication_enabled_for_web).to be_falsey
2017-09-10 17:25:29 +05:30
expect(subject.signup_enabled).to be_truthy
expect(subject.foobar).to eq('asdf')
end
it 'defines predicate methods' do
2018-03-17 18:26:18 +05:30
expect(subject.password_authentication_enabled_for_web?).to be_falsey
2017-09-10 17:25:29 +05:30
expect(subject.signup_enabled?).to be_truthy
end
it 'predicate method changes when value is updated' do
2018-03-17 18:26:18 +05:30
subject.password_authentication_enabled_for_web = true
2017-09-10 17:25:29 +05:30
2018-03-17 18:26:18 +05:30
expect(subject.password_authentication_enabled_for_web?).to be_truthy
2017-09-10 17:25:29 +05:30
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