Sha256: 0ddf5f8b425e9f198cf843badb1edc91b2c6e98f0b33825700b749d27a2ddd90

Contents?: true

Size: 1.67 KB

Versions: 1

Compression:

Stored size: 1.67 KB

Contents

require 'spec_helper'

describe SimpleDeploy do
  before do
    @config_mock = mock 'config mock'
    @logger_mock = mock 'logger mock'
    @config_mock.should_receive(:region).with('preprod').
                 and_return 'us-west-1'
    @config_mock.should_receive(:logger).and_return @logger_mock

    options = { :config      => @config_mock,
                :environment => 'preprod',
                :main_attributes => { 'chef_repo_bucket_prefix' => 'test-prefix' } }
    @formater = SimpleDeploy::StackAttributeFormater.new options
  end

  it "should return updated attributes including cloud formation url" do
    artifact_mock = mock 'artifact'
    SimpleDeploy::Artifact.should_receive(:new).exactly(2).times.
                           with(:name => 'chef_repo',
                                :id   => 'test123',
                                :region => 'us-west-1',
                                :config => @config_mock,
                                :bucket_prefix => 'test-prefix').
                           and_return artifact_mock
    @config_mock.should_receive(:artifact_cloud_formation_url).with('chef_repo').
                 exactly(2).times.
                 and_return('CookBooksURL')
    @config_mock.should_receive(:artifacts).exactly(3).times.
                 and_return ['chef_repo', 'cookbooks', 'app']
    @logger_mock.should_receive(:info)
    artifact_mock.should_receive(:endpoints).exactly(2).times.
                                             and_return 's3' => 's3_url'
    @formater.updated_attributes([ { 'chef_repo' => 'test123' } ]).
              should == [ { "chef_repo" => "test123" }, 
                          { "CookBooksURL" =>"s3_url" } ]
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
simple_deploy-0.5.0 spec/stack/stack_attribute_formater_spec.rb