Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/spec/lib
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2019-03-11 16:29:11 +0300
committerLin Jen-Shin <godfat@godfat.org>2019-03-19 08:01:37 +0300
commit7067806634a50df11a089fecd3c38200e248d499 (patch)
tree43422c20507cd9914e5ed6316a65330bf6c186f5 /spec/lib
parent364791c9f02c5e1d44776fa8e48453dd447d4630 (diff)
Add a few tests for fake applications
Diffstat (limited to 'spec/lib')
-rw-r--r--spec/lib/gitlab/fake_application_settings_spec.rb53
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