Sha256: fa8418ebf8296f160cf5533c06de9306a6f3b5e0478f50a19417cfed74635fb3
Contents?: true
Size: 1.3 KB
Versions: 4
Compression:
Stored size: 1.3 KB
Contents
require 'spec_helper' describe Expense do it "should allow creating an expense account" do expense = Factory(:expense) end it "should report a balance for the expense account" do expense = Factory(:expense) expense.balance.should be_kind_of(BigDecimal) end it "should report a balance for the class of accounts" do Expense.should respond_to(:balance) Expense.balance.should be_kind_of(BigDecimal) end it "should not report a trial balance" do lambda{Expense.trial_balance}.should raise_error(NoMethodError) end it "should not be valid without a name" do expense = Factory.build(:expense, :name => nil) expense.should_not be_valid end it "should have many credit transactions" do expense = Factory(:expense) expense.should respond_to(:credit_transactions) end it "should have many debit transactions" do expense = Factory(:expense) expense.should respond_to(:debit_transactions) end it "a contra account should reverse the normal balance" do expense = Factory(:expense) contra_expense = Factory(:expense, :contra => true) transaction = Factory(:transaction, :credit_account => contra_expense, :debit_account => expense, :amount => 1000) contra_expense.balance.should > 0 Expense.balance.should == 0 end end
Version data entries
4 entries across 4 versions & 2 rubygems
Version | Path |
---|---|
blawzoo-plutus-0.5.3 | spec/models/expense_spec.rb |
plutus-0.5.2 | spec/models/expense_spec.rb |
plutus-0.5.1 | spec/models/expense_spec.rb |
plutus-0.4.2 | spec/models/expense_spec.rb |