summaryrefslogtreecommitdiff
path: root/spec/lib/gitlab/fake_application_settings_spec.rb
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2017-06-21 09:43:58 -0700
committerStan Hu <stanhu@gmail.com>2017-06-21 09:43:58 -0700
commit0f943c941bf0c7abc0358598f4a323b031bcca80 (patch)
tree7dd8ea3484252d469368498846c2c2b7f7500af4 /spec/lib/gitlab/fake_application_settings_spec.rb
parent74fbc694de9a9cfe8a048c3c8d937f8e7068ce21 (diff)
parent043f8c260f49bb14f1c40ec563179c12c3df7828 (diff)
downloadgitlab-ce-0f943c941bf0c7abc0358598f4a323b031bcca80.tar.gz
Merge branch 'master' into sh-headless-chrome-support
Diffstat (limited to 'spec/lib/gitlab/fake_application_settings_spec.rb')
-rw-r--r--spec/lib/gitlab/fake_application_settings_spec.rb32
1 files changed, 32 insertions, 0 deletions
diff --git a/spec/lib/gitlab/fake_application_settings_spec.rb b/spec/lib/gitlab/fake_application_settings_spec.rb
new file mode 100644
index 00000000000..b793176d84a
--- /dev/null
+++ b/spec/lib/gitlab/fake_application_settings_spec.rb
@@ -0,0 +1,32 @@
+require 'spec_helper'
+
+describe Gitlab::FakeApplicationSettings do
+ let(:defaults) { { signin_enabled: false, foobar: 'asdf', signup_enabled: true, 'test?' => 123 } }
+
+ subject { described_class.new(defaults) }
+
+ it 'wraps OpenStruct variables properly' do
+ expect(subject.signin_enabled).to be_falsey
+ expect(subject.signup_enabled).to be_truthy
+ expect(subject.foobar).to eq('asdf')
+ end
+
+ it 'defines predicate methods' do
+ expect(subject.signin_enabled?).to be_falsey
+ expect(subject.signup_enabled?).to be_truthy
+ end
+
+ it 'predicate method changes when value is updated' do
+ subject.signin_enabled = true
+
+ expect(subject.signin_enabled?).to be_truthy
+ 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