Sha256: 9677688f161c226f2f318a21622f704a0edff61b8b67f76657aee3fd2f7fb0aa

Contents?: true

Size: 1.37 KB

Versions: 5

Compression:

Stored size: 1.37 KB

Contents

require 'spec_helper'

describe Heirloom do

  before do
    @config = { 'aws' => 
                { 'access_key'     => 'key',
                  'secret_key'     => 'secret',
                  'primary_region' => 'us-west-2'
                }
              }
  end

  it "should create a new config object from the hash passed as config" do
    config = Heirloom::Config.new :config => @config,
                                  :logger => 'da-logger'
    config.access_key.should == @config['aws']['access_key']
    config.secret_key.should == @config['aws']['secret_key']
    config.primary_region.should == @config['aws']['primary_region']
    config.logger.should == 'da-logger'
  end

  it "should create a new config object and read from ~/.heirloom.yml" do
    File.should_receive(:open).with("#{ENV['HOME']}/.heirloom.yml").
                               and_return(@config.to_yaml)
    config = Heirloom::Config.new
    config.access_key.should == @config['aws']['access_key']
    config.secret_key.should == @config['aws']['secret_key']
    config.primary_region.should == @config['aws']['primary_region']
  end

  it "should set the primary region to us-west-1 if not present in config" do
    @config['aws'] = {}
    config = Heirloom::Config.new :config => @config,
                                  :logger => 'da-logger'
    config.primary_region.should == 'us-west-1'
  end


end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
heirloom-0.4.1rc1 spec/config_spec.rb
heirloom-0.4.0 spec/config_spec.rb
heirloom-0.3.1 spec/config_spec.rb
heirloom-0.3.0 spec/config_spec.rb
heirloom-0.3.0.rc1 spec/config_spec.rb