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
2019-05-30 16:15:17 +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
2019-05-30 16:15:17 +05:30
subject { described_class.new(defaults) }
2017-09-10 17:25:29 +05:30
it 'wraps OpenStruct variables properly' do
2019-05-30 16:15:17 +05:30
expect(subject.password_authentication_enabled_for_web).to be_falsey
expect(subject.signup_enabled).to be_truthy
expect(subject.foobar).to eq('asdf')
2017-09-10 17:25:29 +05:30
end
it 'defines predicate methods' do
2019-05-30 16:15:17 +05:30
expect(subject.password_authentication_enabled_for_web?).to be_falsey
expect(subject.signup_enabled?).to be_truthy
end
it 'predicate method changes when value is updated' do
subject.password_authentication_enabled_for_web = true
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
2019-05-30 16:15:17 +05:30
expect(subject.foobar?).to be_nil
2017-09-10 17:25:29 +05:30
end
it 'does not override an existing predicate method' do
2019-05-30 16:15:17 +05:30
expect(subject.test?).to eq(123)
2017-09-10 17:25:29 +05:30
end
end