Sha256: df4814a7dc2e5a4df2f1a48934b254b6e1384f58357a8e8f221ac530844a93d0

Contents?: true

Size: 1.71 KB

Versions: 12

Compression:

Stored size: 1.71 KB

Contents

require 'spec_helper'
require 'heirloom/cli'

describe Heirloom do

  before do
    options = { :name            => 'archive_name',
                :id              => '1.0.0',
                :level           => 'info',
                :metadata_region => 'us-west-1' }
    @logger_stub = stub :debug => true
    @config_mock = mock 'config'
    @archive_mock = mock 'archive'
    @config_mock.stub :logger          => @logger_stub, 
                      :access_key      => 'key',
                      :secret_key      => 'secret',
                      :metadata_region => 'us-west-1'
    Trollop.stub(:options).and_return options
    Heirloom::HeirloomLogger.should_receive(:new).with(:log_level => 'info').
                             and_return @logger_stub
    Heirloom::CLI::Show.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.stub :domain_exists? => true
    @cli_show = Heirloom::CLI::Show.new
  end

  it "should show a given id" do
    @archive_mock.should_receive(:show).and_return( { 'id' => '1.0.0' } )
    @cli_show.should_receive(:jj).with 'id' => '1.0.0'
    @cli_show.show
  end

end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
heirloom-0.7.4 spec/cli/show_spec.rb
heirloom-0.7.3 spec/cli/show_spec.rb
heirloom-0.7.3rc2 spec/cli/show_spec.rb
heirloom-0.7.3rc1 spec/cli/show_spec.rb
heirloom-0.7.2 spec/cli/show_spec.rb
heirloom-0.7.2rc2 spec/cli/show_spec.rb
heirloom-0.7.2rc1 spec/cli/show_spec.rb
heirloom-0.7.1 spec/cli/show_spec.rb
heirloom-0.7.0 spec/cli/show_spec.rb
heirloom-0.7.0rc1 spec/cli/show_spec.rb
heirloom-0.6.1 spec/cli/show_spec.rb
heirloom-0.6.0rc1 spec/cli/show_spec.rb