Sha256: f8afda5aee085e723cb1c2d07cd3ba55fbad1c89da2109108afabdcbdce97896

Contents?: true

Size: 1.39 KB

Versions: 24

Compression:

Stored size: 1.39 KB

Contents

require 'spec_helper'

describe Pacioli::Account do 
  include Helpers

  before(:each) do
    tear_it_down

    @company = Pacioli::register_company do
      with_name "Coca-Cola"
    end
  end

  context "Create Accounts" do

    it "should be able to create an asset account" do
      account = @company.add_asset_account name: "Accounts Receivable"
      account.should be_asset
    end

    it "should be able to create an equity account" do
      account = @company.add_equity_account name: "Shareholders Capital"
      account.should be_equity
    end

    it "should be able to create a liability account" do
      account = @company.add_liability_account name: "Accounts Payable"
      account.should be_liability
    end

    it "should be able to create an expense account" do
      account = @company.add_expense_account name: "Entertainment"
      account.should be_expense
    end

    it "should be able to create an income account" do
      account = @company.add_income_account name: "Sales"
      account.should be_income
    end

    it "should raise an error when trying to add multiple accounts with the same name" do
      @company.add_income_account name: "Sales"
      lambda {
        @company.add_income_account name: "Sales"
      }.should raise_error(Pacioli::CompanyAccountException, "The company has multiple accounts with the same name: 'Sales' already exists")
      
    end

  end
  
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
pacioli-0.0.29 spec/lib/pacioli/account_spec.rb
pacioli-0.0.28 spec/lib/pacioli/account_spec.rb
pacioli-0.0.27 spec/lib/pacioli/account_spec.rb
pacioli-0.0.26 spec/lib/pacioli/account_spec.rb
pacioli-0.0.25 spec/lib/pacioli/account_spec.rb
pacioli-0.0.24 spec/lib/pacioli/account_spec.rb
pacioli-0.0.23 spec/lib/pacioli/account_spec.rb
pacioli-0.0.22 spec/lib/pacioli/account_spec.rb
pacioli-0.0.21 spec/lib/pacioli/account_spec.rb
pacioli-0.0.20 spec/lib/pacioli/account_spec.rb
pacioli-0.0.19 spec/lib/pacioli/account_spec.rb
pacioli-0.0.18 spec/lib/pacioli/account_spec.rb
pacioli-0.0.17 spec/lib/pacioli/account_spec.rb
pacioli-0.0.16 spec/lib/pacioli/account_spec.rb
pacioli-0.0.15 spec/lib/pacioli/account_spec.rb
pacioli-0.0.14 spec/lib/pacioli/account_spec.rb
pacioli-0.0.13 spec/lib/pacioli/account_spec.rb
pacioli-0.0.12 spec/lib/pacioli/account_spec.rb
pacioli-0.0.11 spec/lib/pacioli/account_spec.rb
pacioli-0.0.10 spec/lib/pacioli/account_spec.rb