summaryrefslogtreecommitdiff
path: root/spec/lib/gitlab/fake_application_settings_spec.rb
blob: c81cb83d9f48f02e14e1c64f522caf4a7e417326 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
require 'spec_helper'

describe Gitlab::FakeApplicationSettings do
  let(:defaults) do
    described_class.defaults.merge(
      foobar: 'asdf',
      'test?' => 123
    )
  end

  let(:setting) { described_class.new(defaults) }

  it 'wraps OpenStruct variables properly' do
    expect(setting.password_authentication_enabled_for_web).to be_truthy
    expect(setting.signup_enabled).to be_truthy
    expect(setting.foobar).to eq('asdf')
  end

  it 'defines predicate methods' do
    expect(setting.password_authentication_enabled_for_web?).to be_truthy
    expect(setting.signup_enabled?).to be_truthy
  end

  it 'does not define a predicate method' do
    expect(setting.foobar?).to be_nil
  end

  it 'does not override an existing predicate method' do
    expect(setting.test?).to eq(123)
  end

  it_behaves_like 'application settings examples'
end