Sha256: d8e202b74c77cf8a79ff470955313bec6cef3a0182d50d2a2b5f4c8f99eb49a2
Contents?: true
Size: 1.34 KB
Versions: 2
Compression:
Stored size: 1.34 KB
Contents
require 'spec_helper' require 'stripe' describe StatusCat::Checkers::Stripe do let( :checker ) { StatusCat::Checkers::Stripe.new.freeze } let( :email ) { 'foo@bar.com' } before( :each ) do Stripe::Account.stub( :retrieve ).and_return( @stripe = double( Stripe::Account ) ) end it_should_behave_like 'a status checker' it 'tolerates Stripe being undefined' do stripe = Object.send(:remove_const, :Stripe) expect( checker.status ).to_not be_nil Object.const_set( :Stripe, stripe ) end it 'fails if there is an exception talking to Stripe' do expect( @stripe ).to receive( :email ).and_raise( 'error' ) expect( checker.status ).to_not be_nil end it 'fails if charging is not enabled' do expect( @stripe ).to receive( :charge_enabled ).and_return( false ) expect( @stripe ).to receive( :email ).and_return( email ) expect( checker.status ).to_not be_nil end it 'passes if charging is enabled' do expect( @stripe ).to receive( :charge_enabled ).and_return( true ) expect( @stripe ).to receive( :email ).and_return( email ) expect( checker.status ).to be_nil end it 'uses the account email as the value' do expect( @stripe ).to receive( :charge_enabled ).and_return( true ) expect( @stripe ).to receive( :email ).and_return( email ) expect( checker.value ).to eql( email ) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
status_cat-0.1.0 | spec/lib/status_cat/checkers/stripe_spec.rb |
status_cat-0.0.9 | spec/lib/status_cat/checkers/stripe_spec.rb |