Rebuild rubocop TODOs after auto-correcting

This commit is contained in:
James Mason 2018-04-04 10:18:51 -07:00
parent 31c50255e9
commit 84dbb52d11
No known key found for this signature in database
GPG key ID: 1B3951886C449023
580 changed files with 3689 additions and 3133 deletions

View file

@ -1,8 +1,9 @@
# frozen_string_literal: true
require 'spec_helper'
require 'stripe_mock'
describe Payment do
context 'new payment' do
let(:payment) { create(:payment) }
it 'sets status to "unpaid" by default' do
@ -38,7 +39,7 @@ describe Payment do
let!(:user) { create(:user) }
let!(:conference) { create(:conference) }
let!(:ticket_1) { create(:ticket, price: 10, price_currency: 'USD', conference: conference) }
let!(:tickets) { {ticket_1.id.to_s => '2'} }
let!(:tickets) { { ticket_1.id.to_s => '2' } }
let(:stripe_helper) { StripeMock.create_test_helper }
before { StripeMock.start }
@ -90,42 +91,42 @@ describe Payment do
context 'when the connection to Stripe drops' do
it 'raises exception' do
StripeMock.prepare_error(Stripe::APIConnectionError.new)
expect{ payment.purchase }.not_to raise_error
expect { payment.purchase }.not_to raise_error
end
end
context 'when there is a Stripe API Error' do
it 'raises exception' do
StripeMock.prepare_error(Stripe::APIError.new)
expect{ payment.purchase }.not_to raise_error
expect { payment.purchase }.not_to raise_error
end
end
context 'when there is authentication error' do
it 'raises exception' do
StripeMock.prepare_error(Stripe::AuthenticationError.new)
expect{ payment.purchase }.not_to raise_error
expect { payment.purchase }.not_to raise_error
end
end
context 'when there is a card error' do
it 'raises exception' do
StripeMock.prepare_card_error(:card_declined)
expect{ payment.purchase }.not_to raise_error
expect { payment.purchase }.not_to raise_error
end
end
context 'when the request to Stripe is invalid' do
it 'raises exception' do
StripeMock.prepare_error(Stripe::InvalidRequestError.new('Your request is invalid.', code: 402))
expect{ payment.purchase }.not_to raise_error
expect { payment.purchase }.not_to raise_error
end
end
context 'when Stripe rate limit exceeds' do
it 'raises exception' do
StripeMock.prepare_error(Stripe::RateLimitError.new)
expect{ payment.purchase }.not_to raise_error
expect { payment.purchase }.not_to raise_error
end
end
end