refactor tests

This commit is contained in:
Rishabh Saxena 2016-08-10 23:19:36 +05:30
parent a78804b94d
commit 6bd2e5e335
2 changed files with 0 additions and 17 deletions

View file

@ -90,7 +90,6 @@ describe Payment do
context 'when the connection to Stripe drops' do
it 'raises exception' do
StripeMock.prepare_error(Stripe::APIConnectionError.new)
expect{ Stripe::Charge.create }.to raise_error(Stripe::APIConnectionError)
expect{ payment.purchase }.not_to raise_error
end
end
@ -98,7 +97,6 @@ describe Payment do
context 'when there is a Stripe API Error' do
it 'raises exception' do
StripeMock.prepare_error(Stripe::APIError.new)
expect{ Stripe::Charge.create }.to raise_error(Stripe::APIError)
expect{ payment.purchase }.not_to raise_error
end
end
@ -106,7 +104,6 @@ describe Payment do
context 'when there is authentication error' do
it 'raises exception' do
StripeMock.prepare_error(Stripe::AuthenticationError.new)
expect{ Stripe::Charge.create }.to raise_error(Stripe::AuthenticationError)
expect{ payment.purchase }.not_to raise_error
end
end
@ -114,7 +111,6 @@ describe Payment do
context 'when there is a card error' do
it 'raises exception' do
StripeMock.prepare_card_error(:card_declined)
expect{ Stripe::Charge.create }.to raise_error(Stripe::CardError)
expect{ payment.purchase }.not_to raise_error
end
end
@ -122,7 +118,6 @@ describe Payment do
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{ Stripe::Charge.create }.to raise_error(Stripe::InvalidRequestError)
expect{ payment.purchase }.not_to raise_error
end
end
@ -130,7 +125,6 @@ describe Payment do
context 'when Stripe rate limit exceeds' do
it 'raises exception' do
StripeMock.prepare_error(Stripe::RateLimitError.new)
expect{ Stripe::Charge.create }.to raise_error(Stripe::RateLimitError)
expect{ payment.purchase }.not_to raise_error
end
end