Rebuild rubocop TODOs after auto-correcting
This commit is contained in:
parent
31c50255e9
commit
84dbb52d11
580 changed files with 3689 additions and 3133 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue