Skip to content

Commit

Permalink
Add test for unsuccesssful verification and fraud.
Browse files Browse the repository at this point in the history
  • Loading branch information
hectoregm committed May 4, 2016
1 parent d459739 commit 777ab27
Show file tree
Hide file tree
Showing 3 changed files with 231 additions and 0 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions spec/solidus/gateway/braintree_gateway_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,26 @@
end
end

context 'unsuccessful card verification' do
let(:nonce) { Braintree::Test::Nonce::ProcessorDeclinedVisa }

it 'fails' do
expect{
payment_method.create_profile(payment)
}.to raise_error(Spree::Core::GatewayError, 'Do Not Honor')
end
end

context 'fraudulent purchase' do
let(:nonce) { Braintree::Test::Nonce::GatewayRejectedFraud }

it 'fails' do
expect{
payment_method.create_profile(payment)
}.to raise_error(Spree::Core::GatewayError, 'Gateway Rejected: fraud')
end
end

context 'payment has associated device_data' do
it 'sends it to Braintree' do
payment = FactoryGirl.build(:payment,
Expand Down

0 comments on commit 777ab27

Please sign in to comment.