Commit 70678066 authored by Lin Jen-Shin's avatar Lin Jen-Shin

Add a few tests for fake applications

parent 364791c9
...@@ -29,4 +29,57 @@ describe Gitlab::FakeApplicationSettings do ...@@ -29,4 +29,57 @@ describe Gitlab::FakeApplicationSettings do
it 'does not override an existing predicate method' do it 'does not override an existing predicate method' do
expect(subject.test?).to eq(123) expect(subject.test?).to eq(123)
end 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 end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment