diff options
author | Lin Jen-Shin <godfat@godfat.org> | 2019-03-11 16:29:11 +0300 |
---|---|---|
committer | Lin Jen-Shin <godfat@godfat.org> | 2019-03-19 08:01:37 +0300 |
commit | 7067806634a50df11a089fecd3c38200e248d499 (patch) | |
tree | 43422c20507cd9914e5ed6316a65330bf6c186f5 /spec/lib/gitlab/fake_application_settings_spec.rb | |
parent | 364791c9f02c5e1d44776fa8e48453dd447d4630 (diff) |
Add a few tests for fake applications
Diffstat (limited to 'spec/lib/gitlab/fake_application_settings_spec.rb')
-rw-r--r-- | spec/lib/gitlab/fake_application_settings_spec.rb | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/spec/lib/gitlab/fake_application_settings_spec.rb b/spec/lib/gitlab/fake_application_settings_spec.rb index af12e13d36d..0f864c4e124 100644 --- a/spec/lib/gitlab/fake_application_settings_spec.rb +++ b/spec/lib/gitlab/fake_application_settings_spec.rb @@ -29,4 +29,57 @@ describe Gitlab::FakeApplicationSettings do it 'does not override an existing predicate method' do expect(subject.test?).to eq(123) end + + describe '#commit_email_hostname' do + context 'when the value is provided' do + let(:defaults) { { commit_email_hostname: 'localhost' } } + + it 'returns the provided value' do + expect(subject.commit_email_hostname).to eq('localhost') + end + end + + context 'when the value is not provided' do + it 'returns the default from the class' do + expect(subject.commit_email_hostname) + .to eq(described_class.default_commit_email_hostname) + end + end + end + + describe '#usage_ping_enabled' do + context 'when usage ping can be configured' do + before do + allow(Settings.gitlab) + .to receive(:usage_ping_enabled).and_return(true) + end + + it 'returns the value provided' do + subject.usage_ping_enabled = true + + expect(subject.usage_ping_enabled).to eq(true) + + subject.usage_ping_enabled = false + + expect(subject.usage_ping_enabled).to eq(false) + end + end + + context 'when usage ping cannot be configured' do + before do + allow(Settings.gitlab) + .to receive(:usage_ping_enabled).and_return(false) + end + + it 'always returns false' do + subject.usage_ping_enabled = true + + expect(subject.usage_ping_enabled).to eq(false) + + subject.usage_ping_enabled = false + + expect(subject.usage_ping_enabled).to eq(false) + end + end + end end |