Sha256: 889ac13b99a02302e0805b39184354e9e028e8d2e6792f208ec1c2e131be91b4
Contents?: true
Size: 1.33 KB
Versions: 1
Compression:
Stored size: 1.33 KB
Contents
require 'stripe' describe StatusCat::Checkers::Stripe do let( :checker ) { StatusCat::Checkers::Stripe.new.freeze } let( :email ) { 'foo@bar.com' } before( :each ) do allow( Stripe::Account ).to receive( :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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
status_cat-0.1.1 | spec/lib/status_cat/checkers/stripe_spec.rb |