Sha256: 2ca5bae935b829d4444e204acc39b1c173bff781b02139acc0a7b9a6f3721258
Contents?: true
Size: 1.24 KB
Versions: 1
Compression:
Stored size: 1.24 KB
Contents
require_relative 'test_helper' class GlPostingTest < Skr::TestCase def setup gle = GlManualEntry.create({ notes: 'A good test' }) @glt = gle.gl_transaction = GlTransaction.new({ source: gle }) @glt.location = skr_locations(:default) @glt.add_posting( amount: 33.42, debit: skr_gl_accounts(:cash), credit: skr_gl_accounts(:inventory) ) end def test_attribute_caching assert_saves @glt assert_equal '110001', @glt.credits.first.account_number assert_equal Date.today.year, @glt.credits.first.year assert_equal Date.today.month, @glt.credits.first.period end def test_it_cannot_be_updated assert_saves @glt @glt.credits.first.amount = 33 assert_raises( ActiveRecord::ReadOnlyRecord ) do @glt.credits.first.save end end def test_no_adding_to_transaction assert_saves @glt posting = @glt.credits.create({ account_number: '100000', amount: 22 }) assert posting.new_record?, "allowed saving an adhoc posting" assert_equal ["does not accept new postings"], posting.errors[:gl_transaction] end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
stockor-core-0.2 | test/gl_posting_test.rb |