Sha256: d51727c58fb69ec9f91c72548781c742679726a9e7530359fd4ebfda89e177a7

Contents?: true

Size: 1.48 KB

Versions: 9

Compression:

Stored size: 1.48 KB

Contents

require 'spec_helper'
require 'complex_config/shortcuts'

RSpec.describe 'shortcuts' do
  let :provider do
    ComplexConfig::Provider
  end

  before do
    provider.root = Pathname.new(__FILE__).dirname.dirname
  end

  it 'has the complex_config_with_env "shortcut"' do
    settings = complex_config_with_env('config', 'development')
    expect(settings).to be_a ComplexConfig::Settings
    expect(settings.config.baz).to eq 'something'
    settings = complex_config_with_env('config', 'test')
    expect(settings).to be_a ComplexConfig::Settings
    expect(settings.config.baz).to eq 'something else'
  end

  it 'has the alias cc for complex_config_with_env' do
    settings = cc(:config, :development)
    expect(settings).to be_a ComplexConfig::Settings
    expect(settings.config.baz).to eq 'something'
  end

  it 'considers the environment for complex_config_with_env' do
    settings = complex_config_with_env('config')
    expect(settings).to be_a ComplexConfig::Settings
    expect(settings.config.baz).to eq 'something'
    allow(provider).to receive(:env).and_return('test')
    settings = complex_config_with_env('config')
    expect(settings).to be_a ComplexConfig::Settings
    expect(settings.config.baz).to eq 'something else'
  end

  it 'has the complex_config shortcut' do
    settings = complex_config(:config)
    expect(settings).to be_a ComplexConfig::Settings
    expect(settings.development.config.baz).to eq 'something'
    expect(settings.test.config.baz).to eq 'something else'
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
complex_config-0.3.1 spec/complex_config/shortcuts_spec.rb
complex_config-0.3.0 spec/complex_config/shortcuts_spec.rb
complex_config-0.2.3 spec/complex_config/shortcuts_spec.rb
complex_config-0.2.2 spec/complex_config/shortcuts_spec.rb
complex_config-0.2.1 spec/complex_config/shortcuts_spec.rb
complex_config-0.2.0 spec/complex_config/shortcuts_spec.rb
complex_config-0.1.1 spec/complex_config/shortcuts_spec.rb
complex_config-0.1.0 spec/complex_config/shortcuts_spec.rb
complex_config-0.0.0 spec/complex_config/shortcuts_spec.rb