Sha256: ec8d112c6cbdb43d99bb63c6449aa1b7192a3c999f81d43a459775ea8b7a6690

Contents?: true

Size: 1.64 KB

Versions: 1

Compression:

Stored size: 1.64 KB

Contents

require 'spec_helper'

describe Heirloom do

  before do
    @config = { 'aws' => 
                { 'access_key'              => 'key',
                  'secret_key'              => 'secret',
                  'regions'                 => ['us-west-1', 'us-west-2'],
                  'bucket_prefix'           => 'prefix',
                  'authorized_aws_accounts' => [ 'test1 @acct.com', 'test2@acct.com' ]
                },
                'logger' => 'da-logger'
              }
  end

  it "should create a new config object from the hash passed as config" do
    config = Heirloom::Config.new :config => @config
    config.access_key.should == @config['aws']['access_key']
    config.secret_key.should == @config['aws']['secret_key']
    config.regions.should == @config['aws']['regions']
    config.primary_region.should == 'us-west-1'
    config.bucket_prefix.should == @config['aws']['bucket_prefix']
    config.authorized_aws_accounts.should == @config['aws']['authorized_aws_accounts']
    config.logger.should == @config['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.regions.should == @config['aws']['regions']
    config.primary_region.should == 'us-west-1'
    config.bucket_prefix.should == @config['aws']['bucket_prefix']
    config.authorized_aws_accounts.should == @config['aws']['authorized_aws_accounts']
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
heirloom-0.1.4 spec/config_spec.rb