Sha256: 7294ec6ad080e5771d4103f9e80280f5186670b9cfa1483b460a1631e39602c7

Contents?: true

Size: 1.7 KB

Versions: 5

Compression:

Stored size: 1.7 KB

Contents

require 'spec_helper'

describe Heirloom::Catalog::Verify do

  before do
    @sdb_double    = double 'sdb'
    @logger_double = double 'logger', :info => true,
                                      :debug => true
    @config_double = double 'config', :logger          => @logger_double,
                                      :metadata_region => 'us-west-1'
    Heirloom::AWS::SimpleDB.should_receive(:new).
                            with(:config => @config_double).
                            and_return @sdb_double
    @verify = Heirloom::Catalog::Verify.new :config => @config_double,
                                            :name   => 'a_archive'

  end

  context "testing catalog_domain_exists" do
    it "should return true if heirloom domain exists" do
      @sdb_double.should_receive(:domain_exists?).
                  with('heirloom').and_return true
      @verify.catalog_domain_exists?.should be_true
    end

    it "should return false if heirloom domain does not exists" do
      @sdb_double.should_receive(:domain_exists?).
                  with('heirloom').and_return false
      @verify.catalog_domain_exists?.should be_false
    end
  end

  context "testing entry_exists_in_catalog?" do
    it "should return true if an entry exists in catalog" do
      @sdb_double.should_receive(:item_count).
                  with('heirloom', 'heirloom_a_archive').and_return 1
      @verify.entry_exists_in_catalog?('a_archive').should be_true
    end

    it "should return false if an entry does not exist in catalog" do
      @sdb_double.should_receive(:item_count).
                  with('heirloom', 'heirloom_a_archive').and_return 0
      @verify.entry_exists_in_catalog?('a_archive').should be_false
    end
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

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