Sha256: 73dd0d6b1cf85b38343b0c14d50fdb67295b44ba4df16592127db020cfc42b4d

Contents?: true

Size: 860 Bytes

Versions: 16

Compression:

Stored size: 860 Bytes

Contents

require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
Configliere.use :env_var

describe "Configliere::EnvVar" do
  before do
    @config = Configliere::Param.new
  end

  describe 'loads environment variables' do
    it 'loads a simple value into the corresponding symbolic key' do
      ENV.should_receive(:[]).with('HOME').and_return('/fake/path')
      @config.env_vars 'HOME'
      @config[:home].should == '/fake/path'
    end
    it 'loads a hash into the individual params' do
      ENV.should_receive(:[]).with('HOME').and_return('/fake/path')
      ENV.should_receive(:[]).with('POWER_SUPPLY').and_return('1.21 jigawatts')
      @config.env_vars :home => 'HOME', 'delorean.power_supply' => 'POWER_SUPPLY'
      @config[:home].should == '/fake/path'
      @config[:delorean][:power_supply].should == '1.21 jigawatts'
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
configliere-0.3.4 spec/configliere/env_var_spec.rb
configliere-0.3.3 spec/configliere/env_var_spec.rb
configliere-0.2.3 spec/configliere/env_var_spec.rb
configliere-0.3.2 spec/configliere/env_var_spec.rb
configliere-0.3.1 spec/configliere/env_var_spec.rb
configliere-0.3.0 spec/configliere/env_var_spec.rb
configliere-0.2.2 spec/configliere/env_var_spec.rb
configliere-0.2.1 spec/configliere/env_var_spec.rb
configliere-0.1.1 spec/configliere/env_var_spec.rb
configliere-0.1.0 spec/configliere/env_var_spec.rb
configliere-0.0.9 spec/configliere/env_var_spec.rb
configliere-0.0.8 spec/configliere/env_var_spec.rb
configliere-0.0.7 spec/configliere/env_var_spec.rb
configliere-0.0.6 spec/configliere/env_var_spec.rb
configliere-0.0.5 spec/configliere/env_var_spec.rb
configliere-0.0.4 spec/configliere/env_var_spec.rb