spec/integration/braintree/transaction_spec.rb in braintree-2.5.2 vs spec/integration/braintree/transaction_spec.rb in braintree-2.6.0
- old
+ new
@@ -553,16 +553,17 @@
result = Braintree::Transaction.refund(transaction.id, transaction.amount / 2)
result.success?.should == true
result.transaction.type.should == "credit"
end
- it "does not allow multiple refunds" do
+ it "allows multiple partial refunds" do
transaction = create_transaction_to_refund
- Braintree::Transaction.refund(transaction.id, transaction.amount / 2)
- result = Braintree::Transaction.refund(transaction.id, BigDecimal.new("1"))
- result.success?.should == false
- result.errors.for(:transaction).on(:base)[0].code.should == Braintree::ErrorCodes::Transaction::HasAlreadyBeenRefunded
+ transaction_1 = Braintree::Transaction.refund(transaction.id, transaction.amount / 2).transaction
+ transaction_2 = Braintree::Transaction.refund(transaction.id, transaction.amount / 2).transaction
+
+ transaction = Braintree::Transaction.find(transaction.id)
+ transaction.refund_ids.sort.should == [transaction_1.id, transaction_2.id].sort
end
end
it "returns a successful result if successful" do
transaction = create_transaction_to_refund
@@ -1387,17 +1388,9 @@
it "allows partial refunds" do
transaction = create_transaction_to_refund
result = transaction.refund(transaction.amount / 2)
result.success?.should == true
result.new_transaction.type.should == "credit"
- end
-
- it "does not allow multiple refunds" do
- transaction = create_transaction_to_refund
- transaction.refund(transaction.amount / 2)
- result = transaction.refund(BigDecimal.new("1"))
- result.success?.should == false
- result.errors.for(:transaction).on(:base)[0].code.should == Braintree::ErrorCodes::Transaction::HasAlreadyBeenRefunded
end
end
it "returns a successful result if successful" do
transaction = create_transaction_to_refund