Sha256: 66c77cfef888138f2dc68b2b3ff3c9c7096bea196b482dffe375e3afc4fa7f64

Contents?: true

Size: 894 Bytes

Versions: 2

Compression:

Stored size: 894 Bytes

Contents

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

describe "Configliere::Environment" 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.environment_variables '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.environment_variables 'HOME' => :home, 'POWER_SUPPLY' => 'delorean.power_supply'
      @config[:home].should == '/fake/path'
      @config[:delorean][:power_supply].should == '1.21 jigawatts'
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
configliere-0.0.2 spec/configliere/environment_spec.rb
configliere-0.0.1 spec/configliere/environment_spec.rb