Sha256: 66053eeeda1284e63a6dee4d7f3476ae0df50533db8cf73f40524e95e8fa5200

Contents?: true

Size: 1.05 KB

Versions: 2

Compression:

Stored size: 1.05 KB

Contents

require_relative '../spec_helper'

class PaymentSpec < Skr::TestCase

    it "can be created" do
        assert Payment.create(
            amount: 42.42,
            name: 'Test One, Two, Three',
            category: skr_payment_category(:labor),
            bank_account: skr_bank_account(:checking),
            notes: 'A test payment'
        ), "failed to create payment"
    end

    it "posts to general ledger" do
        bank_account = skr_bank_account(:checking)
        category = skr_payment_category(:labor)

        assert_difference ->{
            category.gl_account.trial_balance
        }, BigDecimal.new('42.42') do

            assert_difference ->{
                bank_account.gl_account.trial_balance
            }, BigDecimal.new('-42.42') do

                Payment.create(
                    amount: 42.42,
                    name: 'Test One, Two, Three',
                    category: category,
                    bank_account: bank_account,
                    notes: 'A test payment'
                )

            end
        end

    end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
stockor-0.3.0 spec/server/models/payment_spec.rb
stockor-0.2 spec/server/models/payment_spec.rb