Sha256: 944714c9e9ff583d65c2c1544023be0c2bf292b995203ac064ecd6e8f7405a7c

Contents?: true

Size: 1.4 KB

Versions: 1

Compression:

Stored size: 1.4 KB

Contents

require 'spec_helper'

describe Heirloom do

    before do
      @config_mock = double 'config'
      @logger_stub = stub 'logger', :info => true, :debug => true
      @config_mock.should_receive(:logger).and_return @logger_stub
      @destroyer = Heirloom::Destroyer.new :config => @config_mock,
                                           :name   => 'tim',
                                           :id     => '123'
    end

    before do
      @reader_mock = mock 'archive reader'
      @destroyer.stub :reader => @reader_mock
      @reader_mock.should_receive(:get_bucket).
                  with(:region => 'us-west-1').
                  and_return 'bucket-us-west-1'


      @s3_destroyer_mock = mock 's3 destroyer'
      Heirloom::Destroyer::S3.should_receive(:new).
                              with(:config => @config_mock,
                                   :region => 'us-west-1').
                              and_return @s3_destroyer_mock
      @s3_destroyer_mock.should_receive(:destroy_file).
                        with :key_name   => '123.tar.gz',
                             :key_folder => 'tim',
                             :bucket     => 'bucket-us-west-1'
      @sdb_mock = mock 'sdb'
      @destroyer.stub :sdb => @sdb_mock
    end

    it "should destroy the given archive" do
      @sdb_mock.should_receive(:delete).with 'heirloom_tim', '123'
      @destroyer.destroy :regions => ['us-west-1']
    end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
heirloom-0.7.0rc1 spec/archive/destroyer_spec.rb