spec/paypal/payment/request_spec.rb in paypal-express-0.4.5 vs spec/paypal/payment/request_spec.rb in paypal-express-0.4.6
- old
+ new
@@ -103,6 +103,26 @@
:L_BILLINGTYPE0 => :MerchantInitiatedBillingSingleAgreement,
:L_BILLINGAGREEMENTDESCRIPTION0 => "Reference Transaction Request"
}
end
end
+
+ describe '#items_amount' do
+ context 'when BigDecimal'
+ let(:instance) do
+ Paypal::Payment::Request.new(
+ :items => [{
+ :quantity => 3,
+ :name => 'Item1',
+ :description => 'Awesome Item 1!',
+ :amount => 130.45
+ }]
+ )
+ end
+
+ # NOTE:
+ # 391.35 * 3 => 391.34999999999997 (in ruby 1.9)
+ it 'should calculate total amount correctly' do
+ instance.items_amount.should == 391.35
+ end
+ end
end