Sha256: c59798ede71719f163ad410a3314f3a3b6b18b1bf2f732ad5f31877cb1fb12b2

Contents?: true

Size: 1.24 KB

Versions: 11

Compression:

Stored size: 1.24 KB

Contents

require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
require File.expand_path(File.dirname(__FILE__) + "/client_api/spec_helper")

describe Braintree::TransactionLineItem do
  describe "self.find_all" do
    it "returns line_items for the specified transaction" do
      result = Braintree::Transaction.create(
        :type => "sale",
        :amount => Braintree::Test::TransactionAmounts::Authorize,
        :credit_card => {
          :number => Braintree::Test::CreditCardNumbers::Visa,
          :expiration_date => "05/2009"
        },
        :line_items => [
          {
            :quantity => "1.0232",
            :name => "Name #1",
            :kind => "debit",
            :unit_amount => "45.1232",
            :total_amount => "45.15",
          },
        ],
      )
      result.success?.should == true
      transaction = result.transaction

      line_items = Braintree::TransactionLineItem.find_all(transaction.id)

      line_item = line_items[0]
      line_item.quantity.should == BigDecimal.new("1.0232")
      line_item.name.should == "Name #1"
      line_item.kind.should == "debit"
      line_item.unit_amount.should == BigDecimal.new("45.1232")
      line_item.total_amount.should == BigDecimal.new("45.15")
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
braintree-2.93.0 spec/integration/braintree/transaction_line_item_spec.rb
braintree-2.92.0 spec/integration/braintree/transaction_line_item_spec.rb
braintree-2.91.0 spec/integration/braintree/transaction_line_item_spec.rb
braintree-2.90.0 spec/integration/braintree/transaction_line_item_spec.rb
braintree-2.89.0 spec/integration/braintree/transaction_line_item_spec.rb
braintree-2.88.0 spec/integration/braintree/transaction_line_item_spec.rb
braintree-2.87.0 spec/integration/braintree/transaction_line_item_spec.rb
braintree-2.86.0 spec/integration/braintree/transaction_line_item_spec.rb
braintree-2.85.0 spec/integration/braintree/transaction_line_item_spec.rb
braintree-2.84.0 spec/integration/braintree/transaction_line_item_spec.rb
braintree-2.83.0 spec/integration/braintree/transaction_line_item_spec.rb