Sha256: 9547690a46d77d6d8f8b782c0ac67b9d9a056e7a8a0d59b8e7f28b89b778f39d

Contents?: true

Size: 1.15 KB

Versions: 5

Compression:

Stored size: 1.15 KB

Contents

describe StatusCat::Checkers::Stripe do

  let(:checker) { StatusCat::Checkers::Stripe.new.freeze }
  let(:email) { 'foo@bar.com' }

  it_should_behave_like 'a status checker'

  it 'tolerates the gem misssing' do
    gem = Object.send(:remove_const, :Stripe)
    expect(checker.status).to eql('stripe gem is not installed')
    Object.const_set(:Stripe, gem)
  end

  it 'fails if there is an exception talking to Stripe' do
    expect(@stripe).to receive(:email).and_raise('test 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

5 entries across 5 versions & 1 rubygems

Version Path
status_cat-5.2.1 spec/lib/status_cat/checkers/stripe_spec.rb
status_cat-5.2.0 spec/lib/status_cat/checkers/stripe_spec.rb
status_cat-5.0.2 spec/lib/status_cat/checkers/stripe_spec.rb
status_cat-5.0.1 spec/lib/status_cat/checkers/stripe_spec.rb
status_cat-5.0.0 spec/lib/status_cat/checkers/stripe_spec.rb