Sha256: 839e9680a947e89ed15f5173691e4b89d665bcb6f6806848d1a6fdb239bf2cba

Contents?: true

Size: 1.28 KB

Versions: 3

Compression:

Stored size: 1.28 KB

Contents

require 'spec_helper'

describe Taxedo::Region do
  #*************************************************************************************
  # PUBLIC INSTANCE METHODS
  #*************************************************************************************
  describe "#calculate" do
    context "with the quebec region" do
      let(:region) { Taxedo::Region.new('quebec') }

      context "when calculating taxes on 100$" do
        let(:result) { region.calculate(10000) }

        the("result.taxes.length") { should eql 2 }
        the("result.total") { should eql 11498 }

        context "in July 1994" do
          let(:result) { region.calculate(10000, :on => Time.parse('1994-07-01')) }
          the("result.total") { should eql 11396 }
        end
      end

      context "when calculating taxes on 100$ with a rule that doesn't exists" do
        it { expect { region.calculate(10000, :rule => 'unknown') }.to raise_error("TAXEDO: This tax rule doesn't exists!") }
      end
    end

    context "with the can region" do
      let(:region) { Taxedo::Region.new('can') }

      context "when calculating taxes on 100$" do
        let(:result) { region.calculate(10000) }

        the("result.taxes.length") { should eql 1 }
        the("result.total") { should eql 10500 }
      end
    end
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
taxedo-0.0.6 spec/taxedo/region_spec.rb
taxedo-0.0.5 spec/taxedo/region_spec.rb
taxedo-0.0.4 spec/taxedo/region_spec.rb