Sha256: a12c178cc40d2b10b3c09101321cef10808d9aa99da7356040e907d4e8f4bb43

Contents?: true

Size: 1.69 KB

Versions: 2

Compression:

Stored size: 1.69 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 'logger'
    @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::Destroy.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(:id   => '1.0.0',
                           :name => 'archive_name',
                           :config => @config_mock).
                      and_return @archive_mock
    @archive_mock.stub :exists? => true
    @archive_mock.should_receive(:domain_exists?).and_return true
    @cli_destroy = Heirloom::CLI::Destroy.new
  end

  it "should destroy an archive" do
    @archive_mock.should_receive(:destroy).with :keep_domain => false
    @cli_destroy.destroy
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
heirloom-0.6.1 spec/cli/destroy_spec.rb
heirloom-0.6.0rc1 spec/cli/destroy_spec.rb