Sha256: d1177c3b94185200e29dcb649218a4a9681b8d2e0ef5e5ed7057006eb70b2862

Contents?: true

Size: 1.86 KB

Versions: 5

Compression:

Stored size: 1.86 KB

Contents

require 'spec_helper'
require 'heirloom/cli'

describe Heirloom do

  before do
    options = { :name            => 'archive_name',
                :id              => '1.0.0',
                :level           => 'info',
                :attribute       => 'att',
                :value           => 'val',
                :metadata_region => 'us-west-1' }
    @logger_stub = stub :debug => true, :error => true
    @config_mock = mock_config(:logger => @logger_stub)
    @archive_mock = mock 'archive'
    
    Trollop.stub(:options).and_return options
    Heirloom::HeirloomLogger.should_receive(:new).with(:log_level => 'info').
                             and_return @logger_stub
    Heirloom::CLI::Tag.any_instance.should_receive(:load_config).
                       with(:logger => @logger_stub,
                            :opts   => options).
                       and_return @config_mock
    Heirloom::Archive.should_receive(:new).
                      with(:name => 'archive_name',
                           :config => @config_mock).
                      and_return @archive_mock
    Heirloom::Archive.should_receive(:new).
                      with(:name   => 'archive_name',
                           :id     => '1.0.0',
                           :config => @config_mock).
                      and_return @archive_mock
    @archive_mock.stub :exists? => true
    @archive_mock.should_receive(:domain_exists?).and_return true
    @cli_tag = Heirloom::CLI::Tag.new
  end

  it "should tag an archive attribute with a given id" do
    @archive_mock.stub :exists? => true
    @archive_mock.should_receive(:update).
                  with(:attribute => 'att',
                       :value     => 'val')
    @cli_tag.tag
  end

  it "should exit if the archive does not exist" do
    @archive_mock.stub :exists? => false
    lambda { @cli_tag.tag }.should raise_error SystemExit
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
heirloom-0.12.1 spec/cli/tag_spec.rb
heirloom-0.12.0 spec/cli/tag_spec.rb
heirloom-0.11.2 spec/cli/tag_spec.rb
heirloom-0.11.1 spec/cli/tag_spec.rb
heirloom-0.11.0 spec/cli/tag_spec.rb