Sha256: 17bfc9bbd607ad5d176dc432360895070dc18e263c0d1f0862cb8b51ea952f70

Contents?: true

Size: 794 Bytes

Versions: 3

Compression:

Stored size: 794 Bytes

Contents

require 'unit_test_helper'

class LineItemSumTest < Test::Unit::TestCase
  include Xeroizer::Record

  def setup
    parent = stub(:application => nil, :mark_dirty => nil)
    @the_line_items = [
      LineItem.build({:quantity => 1, :unit_amount => 1.00, :tax_amount => 0.15}, parent),
      LineItem.build({:quantity => 1, :unit_amount => 1.00, :tax_amount => 0.30}, parent),
    ]
  end

  it "sub_total is the sum of the line_amounts" do
    assert_equal BigDecimal("2.00"), LineItemSum.sub_total(@the_line_items)
  end

  it "total_tax is the sum of the tax_amounts" do
    assert_equal BigDecimal("0.45"), LineItemSum.total_tax(@the_line_items)
  end

  it "total is the sum of sub_total and total_tax" do
    assert_equal BigDecimal("2.45"), LineItemSum.total(@the_line_items)
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
xeroizer-3.0.1 test/unit/models/line_item_sum_test.rb
xeroizer-3.0.0 test/unit/models/line_item_sum_test.rb
xeroizer-3-pre-beta-3.0.0.pre.beta test/unit/models/line_item_sum_test.rb