keepr 0.0.1 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -2
- data/README.md +1 -1
- data/ci/Gemfile-rails-4-1 +2 -1
- data/ci/Gemfile-rails-4-2 +2 -1
- data/keepr.gemspec +1 -0
- data/lib/generators/keepr/migration/templates/migration.rb +1 -0
- data/lib/keepr/account.rb +20 -11
- data/lib/keepr/active_record_extension.rb +7 -1
- data/lib/keepr/group.rb +8 -0
- data/lib/keepr/groups_creator.rb +2 -2
- data/lib/keepr/journal.rb +9 -0
- data/lib/keepr/version.rb +1 -1
- data/spec/account_spec.rb +73 -32
- data/spec/active_record_extension_spec.rb +44 -7
- data/spec/factories/account.rb +1 -1
- data/spec/group_spec.rb +15 -0
- data/spec/journal_spec.rb +16 -0
- data/spec/spec_helper.rb +16 -0
- data/spec/support/contact.rb +3 -0
- data/spec/support/ledger.rb +1 -1
- data/spec/support/spec_migration.rb +4 -0
- metadata +19 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 41676e1855dcb2af4b7df3fad8ed257251832317
|
4
|
+
data.tar.gz: eb275e943f86edd5efa5cf2b92fe4627ef28d152
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a491c1d52227749de2aca883072cb6f91ded6a09cc8f51dbee18353a22b3ec12c8150201b269e5f60f361d57b7786959e54afccba7eecf12fb73c5c962db37f9
|
7
|
+
data.tar.gz: c1e1703a56d273389ba00bd2dd4360941b933d72f4ddb3778f88d665175b940dfb5da38901996e4763ff82bdb690d27eef41648a0b0b6e6a596d5159494fb584
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
This Ruby gem provides a double entry accounting system for use in any Rails application. It stores all the data via ActiveRecord in the SQL database.
|
4
4
|
|
5
5
|
[![Build Status](https://travis-ci.org/ledermann/keepr.svg?branch=master)](https://travis-ci.org/ledermann/keepr)
|
6
|
-
|
6
|
+
[![Coverage Status](https://coveralls.io/repos/ledermann/keepr/badge.svg?branch=master)](https://coveralls.io/r/ledermann/keepr?branch=master)
|
7
7
|
|
8
8
|
## Features
|
9
9
|
|
data/ci/Gemfile-rails-4-1
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
source 'https://rubygems.org'
|
2
2
|
|
3
|
-
gem 'activerecord', '~> 4.1.
|
3
|
+
gem 'activerecord', '~> 4.1.10'
|
4
4
|
gem 'ancestry'
|
5
5
|
gem 'sqlite3'
|
6
6
|
gem 'rake'
|
@@ -9,3 +9,4 @@ gem 'simplecov'
|
|
9
9
|
gem 'coveralls'
|
10
10
|
gem 'database_cleaner'
|
11
11
|
gem 'factory_girl'
|
12
|
+
gem 'coveralls'
|
data/ci/Gemfile-rails-4-2
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
source 'https://rubygems.org'
|
2
2
|
|
3
|
-
gem 'activerecord', '~> 4.2.
|
3
|
+
gem 'activerecord', '~> 4.2.1'
|
4
4
|
gem 'ancestry'
|
5
5
|
gem 'sqlite3'
|
6
6
|
gem 'rake'
|
@@ -9,3 +9,4 @@ gem 'simplecov'
|
|
9
9
|
gem 'coveralls'
|
10
10
|
gem 'database_cleaner'
|
11
11
|
gem 'factory_girl'
|
12
|
+
gem 'coveralls'
|
data/keepr.gemspec
CHANGED
data/lib/keepr/account.rb
CHANGED
@@ -3,7 +3,7 @@ class Keepr::Account < ActiveRecord::Base
|
|
3
3
|
|
4
4
|
has_ancestry :orphan_strategy => :restrict
|
5
5
|
|
6
|
-
enum :kind => [ :asset, :liability, :revenue, :expense, :neutral ]
|
6
|
+
enum :kind => [ :asset, :liability, :revenue, :expense, :neutral, :debtor, :creditor ]
|
7
7
|
|
8
8
|
validates_presence_of :number, :name
|
9
9
|
validates_uniqueness_of :number
|
@@ -19,14 +19,21 @@ class Keepr::Account < ActiveRecord::Base
|
|
19
19
|
|
20
20
|
default_scope { order(:number) }
|
21
21
|
|
22
|
-
def self.with_sums(
|
22
|
+
def self.with_sums(options={})
|
23
|
+
raise ArgumentError unless options.is_a?(Hash)
|
24
|
+
|
23
25
|
scope = select('keepr_accounts.*, SUM(amount) AS sum_amount').
|
24
26
|
group('keepr_accounts.id').
|
25
27
|
joins('LEFT JOIN keepr_postings ON keepr_postings.keepr_account_id = keepr_accounts.id')
|
26
28
|
|
27
|
-
|
29
|
+
date = options[:date]
|
30
|
+
permanent_only = options[:permanent_only]
|
31
|
+
|
32
|
+
if date || permanent_only
|
28
33
|
scope = scope.joins('LEFT JOIN keepr_journals ON keepr_journals.id = keepr_postings.keepr_journal_id')
|
34
|
+
end
|
29
35
|
|
36
|
+
if date
|
30
37
|
if date.is_a?(Date)
|
31
38
|
scope = scope.where("keepr_journals.id IS NULL OR keepr_journals.date <= '#{date.to_s(:db)}'")
|
32
39
|
elsif date.is_a?(Range)
|
@@ -36,22 +43,24 @@ class Keepr::Account < ActiveRecord::Base
|
|
36
43
|
end
|
37
44
|
end
|
38
45
|
|
46
|
+
if permanent_only
|
47
|
+
scope = scope.where("keepr_journals.id IS NULL OR keepr_journals.permanent = #{connection.quoted_true}")
|
48
|
+
end
|
49
|
+
|
39
50
|
scope
|
40
51
|
end
|
41
52
|
|
42
|
-
def self.merged_with_sums(
|
43
|
-
accounts = with_sums(
|
53
|
+
def self.merged_with_sums(options={})
|
54
|
+
accounts = with_sums(options).to_a
|
44
55
|
|
45
56
|
# Sum up child accounts to parent
|
46
57
|
position = 0
|
47
58
|
while account = accounts[position] do
|
48
|
-
if account.parent_id
|
59
|
+
if account.parent_id && account.sum_amount
|
49
60
|
if parent_account = accounts.find { |a| a.id == account.parent_id }
|
50
61
|
parent_account.sum_amount ||= 0
|
51
62
|
parent_account.sum_amount += account.sum_amount
|
52
63
|
accounts.delete_at(position)
|
53
|
-
else
|
54
|
-
raise
|
55
64
|
end
|
56
65
|
else
|
57
66
|
position += 1
|
@@ -101,11 +110,11 @@ private
|
|
101
110
|
def group_validation
|
102
111
|
if keepr_group.present?
|
103
112
|
if asset?
|
104
|
-
errors.add(:kind, 'does match group') unless keepr_group.asset?
|
113
|
+
errors.add(:kind, 'does not match group') unless keepr_group.asset?
|
105
114
|
elsif liability?
|
106
|
-
errors.add(:kind, 'does match group') unless keepr_group.liability?
|
115
|
+
errors.add(:kind, 'does not match group') unless keepr_group.liability?
|
107
116
|
elsif profit_and_loss?
|
108
|
-
errors.add(:kind, 'does match group') unless keepr_group.profit_and_loss?
|
117
|
+
errors.add(:kind, 'does not match group') unless keepr_group.profit_and_loss?
|
109
118
|
else
|
110
119
|
errors.add(:kind, 'conflicts with group')
|
111
120
|
end
|
@@ -4,8 +4,14 @@ module Keepr::ActiveRecordExtension
|
|
4
4
|
end
|
5
5
|
|
6
6
|
module ClassMethods
|
7
|
-
def
|
7
|
+
def has_one_keepr_account
|
8
8
|
has_one :keepr_account, :class_name => 'Keepr::Account', :as => :accountable
|
9
|
+
has_many :keepr_postings, :class_name => 'Keepr::Posting', :through => :keepr_account
|
10
|
+
end
|
11
|
+
|
12
|
+
def has_many_keepr_accounts
|
13
|
+
has_many :keepr_accounts, :class_name => 'Keepr::Account', :as => :accountable
|
14
|
+
has_many :keepr_postings, :class_name => 'Keepr::Posting', :through => :keepr_accounts
|
9
15
|
end
|
10
16
|
|
11
17
|
def is_keepr_accountable
|
data/lib/keepr/group.rb
CHANGED
@@ -11,6 +11,8 @@ class Keepr::Group < ActiveRecord::Base
|
|
11
11
|
|
12
12
|
before_validation :get_from_parent
|
13
13
|
|
14
|
+
validate :check_result_and_target
|
15
|
+
|
14
16
|
def self.result
|
15
17
|
where(:is_result => true).first
|
16
18
|
end
|
@@ -30,4 +32,10 @@ private
|
|
30
32
|
self.target = self.parent.target
|
31
33
|
end
|
32
34
|
end
|
35
|
+
|
36
|
+
def check_result_and_target
|
37
|
+
if is_result
|
38
|
+
errors.add(:base, 'is_result allowed for liability target only') unless liability?
|
39
|
+
end
|
40
|
+
end
|
33
41
|
end
|
data/lib/keepr/groups_creator.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
class Keepr::GroupsCreator
|
3
3
|
def initialize(target)
|
4
|
+
raise ArgumentError unless [ :balance, :profit_and_loss ].include?(target)
|
5
|
+
|
4
6
|
@target = target
|
5
7
|
end
|
6
8
|
|
@@ -11,8 +13,6 @@ class Keepr::GroupsCreator
|
|
11
13
|
load 'liability.txt', :target => :liability
|
12
14
|
when :profit_and_loss
|
13
15
|
load 'profit_and_loss.txt', :target => :profit_and_loss
|
14
|
-
else
|
15
|
-
raise ArgumentError
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
data/lib/keepr/journal.rb
CHANGED
@@ -28,6 +28,8 @@ class Keepr::Journal < ActiveRecord::Base
|
|
28
28
|
end
|
29
29
|
|
30
30
|
after_initialize :set_defaults
|
31
|
+
before_update :check_permanent
|
32
|
+
before_destroy :check_permanent
|
31
33
|
|
32
34
|
private
|
33
35
|
def existing_postings
|
@@ -45,4 +47,11 @@ private
|
|
45
47
|
errors.add(:base, 'Debit does not match credit!')
|
46
48
|
end
|
47
49
|
end
|
50
|
+
|
51
|
+
def check_permanent
|
52
|
+
if self.permanent_was
|
53
|
+
errors.add(:base, 'Is permanent and cannot be changed!')
|
54
|
+
false
|
55
|
+
end
|
56
|
+
end
|
48
57
|
end
|
data/lib/keepr/version.rb
CHANGED
data/spec/account_spec.rb
CHANGED
@@ -28,6 +28,7 @@ describe Keepr::Account do
|
|
28
28
|
|
29
29
|
before :each do
|
30
30
|
Keepr::Journal.create! :date => Date.yesterday,
|
31
|
+
:permanent => true,
|
31
32
|
:keepr_postings_attributes => [
|
32
33
|
{ :keepr_account => account_1000, :amount => 20, :side => 'debit' },
|
33
34
|
{ :keepr_account => account_1200, :amount => 20, :side => 'credit' }
|
@@ -52,20 +53,38 @@ describe Keepr::Account do
|
|
52
53
|
]
|
53
54
|
end
|
54
55
|
|
55
|
-
describe
|
56
|
-
let!(:result_group)
|
57
|
-
let!(:
|
56
|
+
describe 'validations' do
|
57
|
+
let!(:result_group) { FactoryGirl.create(:group, :target => :liability, :is_result => true) }
|
58
|
+
let!(:liability_group) { FactoryGirl.create(:group, :target => :liability) }
|
59
|
+
let!(:asset_group) { FactoryGirl.create(:group, :target => :asset) }
|
58
60
|
|
59
|
-
it "should not
|
60
|
-
account = FactoryGirl.build(:account, :
|
61
|
+
it "should not allow assigning to result group" do
|
62
|
+
account = FactoryGirl.build(:account, :keepr_group => result_group)
|
61
63
|
expect(account).to_not be_valid
|
62
|
-
expect(account.errors[:keepr_group_id]).to
|
64
|
+
expect(account.errors[:keepr_group_id]).to include('is a result group')
|
63
65
|
end
|
64
66
|
|
65
|
-
it "should
|
66
|
-
account = FactoryGirl.build(:account, :
|
67
|
+
it "should not allow assigning asset account to liability group" do
|
68
|
+
account = FactoryGirl.build(:account, :kind => :asset, :keepr_group => liability_group)
|
69
|
+
expect(account).to_not be_valid
|
70
|
+
expect(account.errors[:kind]).to include('does not match group')
|
71
|
+
end
|
72
|
+
|
73
|
+
it "should not allow assigning liability account to asset group" do
|
74
|
+
account = FactoryGirl.build(:account, :kind => :liability, :keepr_group => asset_group)
|
75
|
+
expect(account).to_not be_valid
|
76
|
+
expect(account.errors[:kind]).to include('does not match group')
|
77
|
+
end
|
78
|
+
|
79
|
+
it "should not allow assigning neutral account to asset group" do
|
80
|
+
account = FactoryGirl.build(:account, :kind => :neutral, :keepr_group => asset_group)
|
81
|
+
expect(account).to_not be_valid
|
82
|
+
expect(account.errors[:kind]).to include('conflicts with group')
|
83
|
+
end
|
84
|
+
|
85
|
+
it "should allow target match" do
|
86
|
+
account = FactoryGirl.build(:account, :kind => :asset, :keepr_group => asset_group)
|
67
87
|
expect(account).to be_valid
|
68
|
-
expect(account.errors[:keepr_group_id]).to be_blank
|
69
88
|
end
|
70
89
|
end
|
71
90
|
|
@@ -99,37 +118,58 @@ describe Keepr::Account do
|
|
99
118
|
end
|
100
119
|
|
101
120
|
describe :with_sums do
|
102
|
-
|
103
|
-
|
121
|
+
context 'without param' do
|
122
|
+
it 'should work' do
|
123
|
+
account1, account2 = Keepr::Account.with_sums
|
104
124
|
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
125
|
+
expect(account1.number).to eq(1000)
|
126
|
+
expect(account1.balance).to eq(110)
|
127
|
+
expect(account2.number).to eq(1200)
|
128
|
+
expect(account2.balance).to eq(-110)
|
129
|
+
end
|
109
130
|
end
|
110
131
|
|
111
|
-
|
112
|
-
|
132
|
+
context 'with date option' do
|
133
|
+
it 'should work with Date' do
|
134
|
+
account1, account2 = Keepr::Account.with_sums(:date => Date.yesterday)
|
135
|
+
|
136
|
+
expect(account1.number).to eq(1000)
|
137
|
+
expect(account1.sum_amount).to eq(10)
|
138
|
+
expect(account2.number).to eq(1200)
|
139
|
+
expect(account2.sum_amount).to eq(-10)
|
140
|
+
end
|
141
|
+
|
142
|
+
it 'should work with Range' do
|
143
|
+
account1, account2 = Keepr::Account.with_sums(:date => Date.today..Date.tomorrow)
|
144
|
+
|
145
|
+
expect(account1.number).to eq(1000)
|
146
|
+
expect(account1.sum_amount).to eq(100)
|
147
|
+
expect(account2.number).to eq(1200)
|
148
|
+
expect(account2.sum_amount).to eq(-100)
|
149
|
+
end
|
113
150
|
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
151
|
+
it 'should raise for other class' do
|
152
|
+
expect { Keepr::Account.with_sums(:date => Time.current) }.to raise_error(ArgumentError)
|
153
|
+
expect { Keepr::Account.with_sums(:date => :foo) }.to raise_error(ArgumentError)
|
154
|
+
end
|
118
155
|
end
|
119
156
|
|
120
|
-
|
121
|
-
|
157
|
+
context 'with permanent_only option' do
|
158
|
+
it 'should filter the permanent journals' do
|
159
|
+
account1, account2 = Keepr::Account.with_sums(:permanent_only => true)
|
122
160
|
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
161
|
+
expect(account1.number).to eq(1000)
|
162
|
+
expect(account1.sum_amount).to eq(20)
|
163
|
+
expect(account2.number).to eq(1200)
|
164
|
+
expect(account2.sum_amount).to eq(-20)
|
165
|
+
end
|
127
166
|
end
|
128
167
|
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
168
|
+
context 'with non-hash param' do
|
169
|
+
it 'should raise' do
|
170
|
+
expect { Keepr::Account.with_sums(0) }.to raise_error(ArgumentError)
|
171
|
+
expect { Keepr::Account.with_sums(:foo) }.to raise_error(ArgumentError)
|
172
|
+
end
|
133
173
|
end
|
134
174
|
end
|
135
175
|
end
|
@@ -137,6 +177,7 @@ end
|
|
137
177
|
describe Keepr::Account, 'with subaccounts' do
|
138
178
|
let!(:account_1400) { FactoryGirl.create(:account, :number => 1400) }
|
139
179
|
let!(:account_10000) { FactoryGirl.create(:account, :number => 10000, :parent => account_1400) }
|
180
|
+
let!(:account_10001) { FactoryGirl.create(:account, :number => 10001, :parent => account_1400) }
|
140
181
|
let!(:account_8400) { FactoryGirl.create(:account, :number => 8400) }
|
141
182
|
|
142
183
|
before :each do
|
@@ -200,7 +241,7 @@ describe Keepr::Account, 'with tax' do
|
|
200
241
|
:name => 'Erlöse 19% USt',
|
201
242
|
:kind => :revenue,
|
202
243
|
:keepr_tax => tax
|
203
|
-
expect(
|
244
|
+
expect(account).to be_valid
|
204
245
|
end
|
205
246
|
|
206
247
|
it "should avoid circular reference" do
|
@@ -1,17 +1,54 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Keepr::ActiveRecordExtension do
|
4
|
-
let
|
5
|
-
let
|
4
|
+
let(:account_1000) { FactoryGirl.create(:account, :number => 1000, :kind => :asset) }
|
5
|
+
let(:account_1200) { FactoryGirl.create(:account, :number => 1200, :kind => :asset) }
|
6
6
|
|
7
7
|
describe 'ledger with associated account' do
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
8
|
+
let(:ledger) { Ledger.create! :bank_name => 'Sparkasse' }
|
9
|
+
let!(:account) { ledger.create_keepr_account! :number => '1250', :kind => :asset, :name => 'Girokonto' }
|
10
|
+
|
11
|
+
it 'has keepr_account' do
|
12
|
+
expect(ledger.keepr_account).to eq(account)
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'has keepr_postings' do
|
16
|
+
journal = Keepr::Journal.create! :keepr_postings_attributes => [
|
17
|
+
{ :keepr_account => account, :amount => 30, :side => 'debit' },
|
18
|
+
{ :keepr_account => account_1200, :amount => 30, :side => 'credit' }
|
19
|
+
]
|
20
|
+
other_journal = Keepr::Journal.create! :keepr_postings_attributes => [
|
21
|
+
{ :keepr_account => account_1000, :amount => 20, :side => 'debit' },
|
22
|
+
{ :keepr_account => account_1200, :amount => 20, :side => 'credit' }
|
23
|
+
]
|
24
|
+
|
25
|
+
expect(ledger.keepr_postings.count).to eq(1)
|
26
|
+
expect(ledger.keepr_postings.first.amount).to eq(30)
|
12
27
|
end
|
28
|
+
end
|
13
29
|
|
14
|
-
|
30
|
+
describe 'contact with multiple associated accounts' do
|
31
|
+
let(:contact) { Contact.create! :name => 'John Doe' }
|
32
|
+
let(:account1) { contact.keepr_accounts.create! :number => '70001', :kind => :debtor, :name => "Doe's main account" }
|
33
|
+
let(:account2) { contact.keepr_accounts.create! :number => '70002', :kind => :debtor, :name => "Doe's second account" }
|
34
|
+
|
35
|
+
it 'has multiple keepr_accounts' do
|
36
|
+
expect(contact.keepr_accounts).to eq([account1, account2])
|
37
|
+
end
|
38
|
+
|
39
|
+
it 'has keepr_postings' do
|
40
|
+
journal = Keepr::Journal.create! :keepr_postings_attributes => [
|
41
|
+
{ :keepr_account => account1, :amount => 30, :side => 'debit' },
|
42
|
+
{ :keepr_account => account_1200, :amount => 30, :side => 'credit' }
|
43
|
+
]
|
44
|
+
other_journal = Keepr::Journal.create! :keepr_postings_attributes => [
|
45
|
+
{ :keepr_account => account_1000, :amount => 20, :side => 'debit' },
|
46
|
+
{ :keepr_account => account_1200, :amount => 20, :side => 'credit' }
|
47
|
+
]
|
48
|
+
|
49
|
+
expect(contact.keepr_postings.count).to eq(1)
|
50
|
+
expect(contact.keepr_postings.first.amount).to eq(30)
|
51
|
+
end
|
15
52
|
end
|
16
53
|
|
17
54
|
describe 'Document with associated journal' do
|
data/spec/factories/account.rb
CHANGED
data/spec/group_spec.rb
CHANGED
@@ -1,6 +1,21 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Keepr::Group do
|
4
|
+
describe 'validations' do
|
5
|
+
it "should allow is_result for liability" do
|
6
|
+
group = Keepr::Group.new(:is_result => true, :target => :liability, :name => 'foo')
|
7
|
+
expect(group.valid?).to eq(true)
|
8
|
+
end
|
9
|
+
|
10
|
+
[ :asset, :profit_and_loss ].each do |target|
|
11
|
+
it "should not allow is_result for #{target}" do
|
12
|
+
group = Keepr::Group.new(:is_result => true, :target => target, :name => 'foo')
|
13
|
+
expect(group.valid?).to eq(false)
|
14
|
+
expect(group.errors[:base]).to include('is_result allowed for liability target only')
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
4
19
|
describe :get_from_parent do
|
5
20
|
it 'should preset parent' do
|
6
21
|
root = FactoryGirl.create :group, :target => :asset
|
data/spec/journal_spec.rb
CHANGED
@@ -76,6 +76,22 @@ describe Keepr::Journal do
|
|
76
76
|
end
|
77
77
|
end
|
78
78
|
|
79
|
+
describe :permanent do
|
80
|
+
before :each do
|
81
|
+
simple_journal.update_attributes! :permanent => true
|
82
|
+
end
|
83
|
+
|
84
|
+
it "should not allow update" do
|
85
|
+
expect(simple_journal.update_attributes :subject => 'foo').to eq(false)
|
86
|
+
expect(simple_journal.errors[:base]).to include('Is permanent and cannot be changed!')
|
87
|
+
end
|
88
|
+
|
89
|
+
it "should not allow destroy" do
|
90
|
+
expect(simple_journal.destroy).to eq(false)
|
91
|
+
expect(simple_journal.errors[:base]).to include('Is permanent and cannot be changed!')
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
79
95
|
describe :postings do
|
80
96
|
it 'should return postings' do
|
81
97
|
expect(simple_journal.keepr_postings.size).to eq(2)
|
data/spec/spec_helper.rb
CHANGED
@@ -1,3 +1,14 @@
|
|
1
|
+
require 'simplecov'
|
2
|
+
require 'coveralls'
|
3
|
+
|
4
|
+
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
|
5
|
+
SimpleCov::Formatter::HTMLFormatter,
|
6
|
+
Coveralls::SimpleCov::Formatter
|
7
|
+
]
|
8
|
+
SimpleCov.start do
|
9
|
+
add_filter '/spec/'
|
10
|
+
end
|
11
|
+
|
1
12
|
require 'active_record'
|
2
13
|
require 'database_cleaner'
|
3
14
|
require 'keepr'
|
@@ -31,6 +42,11 @@ RSpec.configure do |config|
|
|
31
42
|
DatabaseCleaner.clean_with(:truncation)
|
32
43
|
end
|
33
44
|
|
45
|
+
config.after(:suite) do
|
46
|
+
KeeprMigration.down
|
47
|
+
SpecMigration.down
|
48
|
+
end
|
49
|
+
|
34
50
|
config.before(:each) do
|
35
51
|
DatabaseCleaner.start
|
36
52
|
end
|
data/spec/support/ledger.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: keepr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Georg Ledermann
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-04-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -122,6 +122,20 @@ dependencies:
|
|
122
122
|
- - ">="
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: coveralls
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
125
139
|
description: Double entry bookkeeping with Rails
|
126
140
|
email: mail@georg-ledermann.de
|
127
141
|
executables: []
|
@@ -165,6 +179,7 @@ files:
|
|
165
179
|
- spec/journal_spec.rb
|
166
180
|
- spec/posting_spec.rb
|
167
181
|
- spec/spec_helper.rb
|
182
|
+
- spec/support/contact.rb
|
168
183
|
- spec/support/document.rb
|
169
184
|
- spec/support/ledger.rb
|
170
185
|
- spec/support/spec_migration.rb
|
@@ -189,7 +204,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
189
204
|
version: '0'
|
190
205
|
requirements: []
|
191
206
|
rubyforge_project:
|
192
|
-
rubygems_version: 2.4.
|
207
|
+
rubygems_version: 2.4.6
|
193
208
|
signing_key:
|
194
209
|
specification_version: 4
|
195
210
|
summary: Some basic ActiveRecord models to build a double entry bookkeeping application
|
@@ -207,6 +222,7 @@ test_files:
|
|
207
222
|
- spec/journal_spec.rb
|
208
223
|
- spec/posting_spec.rb
|
209
224
|
- spec/spec_helper.rb
|
225
|
+
- spec/support/contact.rb
|
210
226
|
- spec/support/document.rb
|
211
227
|
- spec/support/ledger.rb
|
212
228
|
- spec/support/spec_migration.rb
|