Sha256: 413cb749bb6c3b2178fcdff7e46e86f7191b0581fb44dde4ff3c26c859e5be77

Contents?: true

Size: 1.48 KB

Versions: 13

Compression:

Stored size: 1.48 KB

Contents

require 'spec_helper'

describe Heirloom::Catalog::Add do

  before do
    @regions       = ['us-west-1', 'us-west-2']
    @bucket_prefix = 'bucket_prefix'
    @logger_stub   = stub 'logger', :info => true
    @config_stub   = stub 'config', :logger => @logger_stub
    @verify_stub   = stub 'verify'

    @add = Heirloom::Catalog::Add.new :config => @config_stub,
                                      :name   => 'new_archive'
    Heirloom::Catalog::Verify.should_receive(:new).
                              with(:config => @config_stub).
                              and_return @verify_stub
  end

  it "should call sdb to add the entry to the catalog" do
    @sdb_mock = mock 'sdb'
    @verify_stub.stub :entry_exists_in_catalog? => false
    Heirloom::AWS::SimpleDB.should_receive(:new).
                            with(:config => @config_stub).
                            and_return @sdb_mock
    @sdb_mock.should_receive(:put_attributes).
              with 'heirloom',
                   'heirloom_new_archive',
                   "regions" => @regions, "bucket_prefix" => @bucket_prefix
    @add.add_to_catalog :regions       => @regions,
                        :bucket_prefix => @bucket_prefix
  end

  it "should not add the entry to the catalog if it's already there" do
    @verify_stub.stub :entry_exists_in_catalog? => true
    Heirloom::AWS::SimpleDB.should_receive(:new).never
    @add.add_to_catalog :regions       => @regions,
                        :bucket_prefix => @bucket_prefix
  end

end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
heirloom-0.12.1 spec/catalog/add_spec.rb
heirloom-0.12.0 spec/catalog/add_spec.rb
heirloom-0.11.2 spec/catalog/add_spec.rb
heirloom-0.11.1 spec/catalog/add_spec.rb
heirloom-0.11.0 spec/catalog/add_spec.rb
heirloom-0.11.0.beta.2 spec/catalog/add_spec.rb
heirloom-0.11.0.beta.1 spec/catalog/add_spec.rb
heirloom-0.10.1 spec/catalog/add_spec.rb
heirloom-0.10.0 spec/catalog/add_spec.rb
heirloom-0.9.0 spec/catalog/add_spec.rb
heirloom-0.8.3 spec/catalog/add_spec.rb
heirloom-0.8.2 spec/catalog/add_spec.rb
heirloom-0.8.1 spec/catalog/add_spec.rb