spec/archive/checker_spec.rb in heirloom-0.12.1 vs spec/archive/checker_spec.rb in heirloom-0.12.2
- old
+ new
@@ -1,53 +1,53 @@
require 'spec_helper'
describe Heirloom do
before do
- @config_mock = double 'config'
- @logger_stub = stub 'logger', :debug => true,
- :info => true,
- :warn => true
- @config_mock.stub :logger => @logger_stub
- @checker = Heirloom::Checker.new :config => @config_mock
+ @config_double = double 'config'
+ @logger_double = double 'logger', :debug => true,
+ :info => true,
+ :warn => true
+ @config_double.stub :logger => @logger_double
+ @checker = Heirloom::Checker.new :config => @config_double
@regions = ['us-west-1', 'us-west-2']
end
it "should return true if all bucket names are available" do
- s3_mock = mock 's3'
+ s3_double = double 's3'
Heirloom::AWS::S3.should_receive(:new).
- with(:config => @config_mock,
+ with(:config => @config_double,
:region => 'us-west-1').
- and_return s3_mock
+ and_return s3_double
Heirloom::AWS::S3.should_receive(:new).
- with(:config => @config_mock,
+ with(:config => @config_double,
:region => 'us-west-2').
- and_return s3_mock
- s3_mock.should_receive(:bucket_name_available?).
- with('bp-us-west-1').
- and_return true
- s3_mock.should_receive(:bucket_name_available?).
- with('bp-us-west-2').
- and_return true
+ and_return s3_double
+ s3_double.should_receive(:bucket_name_available?).
+ with('bp-us-west-1').
+ and_return true
+ s3_double.should_receive(:bucket_name_available?).
+ with('bp-us-west-2').
+ and_return true
@checker.bucket_name_available?(:bucket_prefix => 'bp',
:regions => @regions).
should be_true
end
it "should return false if any buckets are unavailable" do
- s3_mock = mock 's3'
+ s3_double = double 's3'
Heirloom::AWS::S3.should_receive(:new).
- with(:config => @config_mock,
+ with(:config => @config_double,
:region => 'us-west-1').
- and_return s3_mock
+ and_return s3_double
Heirloom::AWS::S3.should_receive(:new).
- with(:config => @config_mock,
+ with(:config => @config_double,
:region => 'us-west-2').
- and_return s3_mock
- s3_mock.should_receive(:bucket_name_available?).
+ and_return s3_double
+ s3_double.should_receive(:bucket_name_available?).
with('bp-us-west-1').
and_return false
- s3_mock.should_receive(:bucket_name_available?).
+ s3_double.should_receive(:bucket_name_available?).
with('bp-us-west-2').
and_return true
@checker.bucket_name_available?(:bucket_prefix => 'bp',
:regions => @regions).
should be_false