Sha256: c82f7ee8d1b4a6326bbf609f41149c7bdecb4306b31102286bb27d0e7ef56535
Contents?: true
Size: 1021 Bytes
Versions: 1
Compression:
Stored size: 1021 Bytes
Contents
require 'aws-sdk' describe StatusCat::Checkers::S3 do let( :checker ) { StatusCat::Checkers::S3.new.freeze } before( :each ) do allow( AWS::S3 ).to receive( :new ).and_return( @s3 = double( AWS::S3 ) ) end it_should_behave_like 'a status checker' it 'tolerates AWS being undefined' do aws = Object.send(:remove_const, :AWS) expect( checker.status ).to_not be_nil Object.const_set( :AWS, aws ) end it 'uses the aws access key as the value' do expect( checker.value ).to eql( AWS.config.access_key_id ) end it 'fails if there is an exception talking to S3' do expect( @s3 ).to receive( :buckets ).and_raise( 'error' ) expect( checker.status ).to_not be_nil end it 'fails if there are no S3 buckets' do expect( @s3 ).to receive( :buckets ).and_return( [] ) expect( checker.status ).to_not be_nil end it 'passes if it finds S3 buckets' do expect( @s3 ).to receive( :buckets ).and_return( [ 1 ] ) expect( checker.status ).to be_nil end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
status_cat-0.1.1 | spec/lib/status_cat/checkers/s3_spec.rb |