Sha256: 3fdf2e5dc137c107355dbfcedbc6614bd1d93df375f4d9f75ae20ee3c3c9dcdb

Contents?: true

Size: 1.51 KB

Versions: 5

Compression:

Stored size: 1.51 KB

Contents

require 'spec_helper'

describe Heirloom::Catalog::Add do

  before do
    @regions       = ['us-west-1', 'us-west-2']
    @bucket_prefix = 'bucket_prefix'
    @logger_double = double 'logger', :info => true
    @config_double = double 'config', :logger => @logger_double
    @verify_double = double 'verify'

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

  it "should call sdb to add the entry to the catalog" do
    @sdb_double = double 'sdb'
    @verify_double.stub :entry_exists_in_catalog? => false
    Heirloom::AWS::SimpleDB.should_receive(:new).
                            with(:config => @config_double).
                            and_return @sdb_double
    @sdb_double.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_double.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

5 entries across 5 versions & 1 rubygems

Version Path
heirloom-0.12.7 spec/catalog/add_spec.rb
heirloom-0.12.5 spec/catalog/add_spec.rb
heirloom-0.12.4 spec/catalog/add_spec.rb
heirloom-0.12.3 spec/catalog/add_spec.rb
heirloom-0.12.2 spec/catalog/add_spec.rb