keepr 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/.travis.yml +9 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +62 -0
- data/Rakefile +6 -0
- data/ci/Gemfile-rails-4-1 +11 -0
- data/ci/Gemfile-rails-4-2 +11 -0
- data/keepr.gemspec +31 -0
- data/lib/generators/keepr/migration/migration_generator.rb +23 -0
- data/lib/generators/keepr/migration/templates/migration.rb +72 -0
- data/lib/keepr.rb +15 -0
- data/lib/keepr/account.rb +120 -0
- data/lib/keepr/active_record_extension.rb +27 -0
- data/lib/keepr/cost_center.rb +8 -0
- data/lib/keepr/group.rb +33 -0
- data/lib/keepr/groups_creator.rb +51 -0
- data/lib/keepr/groups_creator/asset.txt +36 -0
- data/lib/keepr/groups_creator/liability.txt +28 -0
- data/lib/keepr/groups_creator/profit_and_loss.txt +31 -0
- data/lib/keepr/journal.rb +48 -0
- data/lib/keepr/posting.rb +74 -0
- data/lib/keepr/tax.rb +13 -0
- data/lib/keepr/version.rb +3 -0
- data/spec/account_spec.rb +210 -0
- data/spec/active_record_extension_spec.rb +60 -0
- data/spec/cost_center_spec.rb +16 -0
- data/spec/database.yml +3 -0
- data/spec/factories/account.rb +7 -0
- data/spec/factories/cost_center.rb +6 -0
- data/spec/factories/group.rb +6 -0
- data/spec/factories/tax.rb +8 -0
- data/spec/group_spec.rb +89 -0
- data/spec/groups_creator_spec.rb +45 -0
- data/spec/journal_spec.rb +111 -0
- data/spec/posting_spec.rb +124 -0
- data/spec/spec_helper.rb +58 -0
- data/spec/support/document.rb +3 -0
- data/spec/support/ledger.rb +3 -0
- data/spec/support/spec_migration.rb +16 -0
- data/spec/tax_spec.rb +35 -0
- metadata +213 -0
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
require 'active_record'
|
2
|
+
require 'database_cleaner'
|
3
|
+
require 'keepr'
|
4
|
+
require 'generators/keepr/migration/templates/migration.rb'
|
5
|
+
|
6
|
+
require 'factory_girl'
|
7
|
+
FactoryGirl.find_definitions
|
8
|
+
|
9
|
+
# Avoid warning message
|
10
|
+
I18n.enforce_available_locales = false
|
11
|
+
|
12
|
+
# Requires supporting ruby files with custom matchers and macros, etc,
|
13
|
+
# in spec/support/ and its subdirectories.
|
14
|
+
Dir[File.expand_path(File.join(File.dirname(__FILE__),'support','**','*.rb'))].each {|f| require f}
|
15
|
+
|
16
|
+
# This file was generated by the `rspec --init` command. Conventionally, all
|
17
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
18
|
+
# Require this file using `require "spec_helper"` to ensure that it is only
|
19
|
+
# loaded once.
|
20
|
+
#
|
21
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
22
|
+
RSpec.configure do |config|
|
23
|
+
# Run specs in random order to surface order dependencies. If you find an
|
24
|
+
# order dependency and want to debug it, you can fix the order by providing
|
25
|
+
# the seed, which is printed after each run.
|
26
|
+
# --seed 1234
|
27
|
+
# config.order = 'random'
|
28
|
+
|
29
|
+
config.before(:suite) do
|
30
|
+
DatabaseCleaner.strategy = :transaction
|
31
|
+
DatabaseCleaner.clean_with(:truncation)
|
32
|
+
end
|
33
|
+
|
34
|
+
config.before(:each) do
|
35
|
+
DatabaseCleaner.start
|
36
|
+
end
|
37
|
+
|
38
|
+
config.after(:each) do
|
39
|
+
DatabaseCleaner.clean
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def setup_db
|
44
|
+
ActiveRecord::Base.configurations = YAML.load_file(File.expand_path('database.yml', File.dirname(__FILE__)))
|
45
|
+
|
46
|
+
ActiveRecord::Base.establish_connection(:sqlite)
|
47
|
+
ActiveRecord::Migration.verbose = false
|
48
|
+
|
49
|
+
ActiveRecord::Base.connection.tables.each do |table|
|
50
|
+
next if table == 'schema_migrations'
|
51
|
+
ActiveRecord::Base.connection.execute("DROP TABLE #{table}")
|
52
|
+
end
|
53
|
+
|
54
|
+
KeeprMigration.up
|
55
|
+
SpecMigration.up
|
56
|
+
end
|
57
|
+
|
58
|
+
setup_db
|
@@ -0,0 +1,16 @@
|
|
1
|
+
class SpecMigration < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table :ledgers, force: true do |t|
|
4
|
+
t.string :bank_name
|
5
|
+
end
|
6
|
+
|
7
|
+
create_table :documents, force: true do |t|
|
8
|
+
t.string :number
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.down
|
13
|
+
drop_table :documents
|
14
|
+
drop_table :contacts
|
15
|
+
end
|
16
|
+
end
|
data/spec/tax_spec.rb
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require 'spec_helper'
|
3
|
+
|
4
|
+
describe Keepr::Tax do
|
5
|
+
let!(:tax_account) { Keepr::Account.create! :number => 1776,
|
6
|
+
:name => 'Umsatzsteuer 19%',
|
7
|
+
:kind => :asset }
|
8
|
+
|
9
|
+
let!(:tax) { Keepr::Tax.create! :name => 'USt19',
|
10
|
+
:description => 'Umsatzsteuer 19%',
|
11
|
+
:value => 19.0,
|
12
|
+
:keepr_account => tax_account }
|
13
|
+
|
14
|
+
let!(:account) { Keepr::Account.create! :number => 8400,
|
15
|
+
:name => 'Erlöse 19% USt',
|
16
|
+
:kind => :revenue,
|
17
|
+
:keepr_tax => tax }
|
18
|
+
|
19
|
+
it 'should be direct linked from account' do
|
20
|
+
expect(tax.keepr_accounts).to eq([account])
|
21
|
+
expect(account.keepr_tax).to eq(tax)
|
22
|
+
expect(tax_account.keepr_tax).to eq(nil)
|
23
|
+
end
|
24
|
+
|
25
|
+
it "should be reverse found from account" do
|
26
|
+
expect(tax_account.keepr_taxes).to eq([tax])
|
27
|
+
expect(account.keepr_taxes).to eq([])
|
28
|
+
end
|
29
|
+
|
30
|
+
it "should avoid circular reference" do
|
31
|
+
tax.keepr_account = account
|
32
|
+
expect(tax).to be_invalid
|
33
|
+
expect(tax.errors[:keepr_account_id]).to be_present
|
34
|
+
end
|
35
|
+
end
|
metadata
ADDED
@@ -0,0 +1,213 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: keepr
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Georg Ledermann
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-01-20 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: activerecord
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '4.1'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '4.1'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: ancestry
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.3'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.3'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: sqlite3
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rspec
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: database_cleaner
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: factory_girl
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
description: Double entry bookkeeping with Rails
|
126
|
+
email: mail@georg-ledermann.de
|
127
|
+
executables: []
|
128
|
+
extensions: []
|
129
|
+
extra_rdoc_files: []
|
130
|
+
files:
|
131
|
+
- ".gitignore"
|
132
|
+
- ".travis.yml"
|
133
|
+
- Gemfile
|
134
|
+
- LICENSE.txt
|
135
|
+
- README.md
|
136
|
+
- Rakefile
|
137
|
+
- ci/Gemfile-rails-4-1
|
138
|
+
- ci/Gemfile-rails-4-2
|
139
|
+
- keepr.gemspec
|
140
|
+
- lib/generators/keepr/migration/migration_generator.rb
|
141
|
+
- lib/generators/keepr/migration/templates/migration.rb
|
142
|
+
- lib/keepr.rb
|
143
|
+
- lib/keepr/account.rb
|
144
|
+
- lib/keepr/active_record_extension.rb
|
145
|
+
- lib/keepr/cost_center.rb
|
146
|
+
- lib/keepr/group.rb
|
147
|
+
- lib/keepr/groups_creator.rb
|
148
|
+
- lib/keepr/groups_creator/asset.txt
|
149
|
+
- lib/keepr/groups_creator/liability.txt
|
150
|
+
- lib/keepr/groups_creator/profit_and_loss.txt
|
151
|
+
- lib/keepr/journal.rb
|
152
|
+
- lib/keepr/posting.rb
|
153
|
+
- lib/keepr/tax.rb
|
154
|
+
- lib/keepr/version.rb
|
155
|
+
- spec/account_spec.rb
|
156
|
+
- spec/active_record_extension_spec.rb
|
157
|
+
- spec/cost_center_spec.rb
|
158
|
+
- spec/database.yml
|
159
|
+
- spec/factories/account.rb
|
160
|
+
- spec/factories/cost_center.rb
|
161
|
+
- spec/factories/group.rb
|
162
|
+
- spec/factories/tax.rb
|
163
|
+
- spec/group_spec.rb
|
164
|
+
- spec/groups_creator_spec.rb
|
165
|
+
- spec/journal_spec.rb
|
166
|
+
- spec/posting_spec.rb
|
167
|
+
- spec/spec_helper.rb
|
168
|
+
- spec/support/document.rb
|
169
|
+
- spec/support/ledger.rb
|
170
|
+
- spec/support/spec_migration.rb
|
171
|
+
- spec/tax_spec.rb
|
172
|
+
homepage: https://github.com/ledermann/keepr
|
173
|
+
licenses:
|
174
|
+
- MIT
|
175
|
+
metadata: {}
|
176
|
+
post_install_message:
|
177
|
+
rdoc_options: []
|
178
|
+
require_paths:
|
179
|
+
- lib
|
180
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
181
|
+
requirements:
|
182
|
+
- - ">="
|
183
|
+
- !ruby/object:Gem::Version
|
184
|
+
version: 1.9.3
|
185
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
186
|
+
requirements:
|
187
|
+
- - ">="
|
188
|
+
- !ruby/object:Gem::Version
|
189
|
+
version: '0'
|
190
|
+
requirements: []
|
191
|
+
rubyforge_project:
|
192
|
+
rubygems_version: 2.4.5
|
193
|
+
signing_key:
|
194
|
+
specification_version: 4
|
195
|
+
summary: Some basic ActiveRecord models to build a double entry bookkeeping application
|
196
|
+
test_files:
|
197
|
+
- spec/account_spec.rb
|
198
|
+
- spec/active_record_extension_spec.rb
|
199
|
+
- spec/cost_center_spec.rb
|
200
|
+
- spec/database.yml
|
201
|
+
- spec/factories/account.rb
|
202
|
+
- spec/factories/cost_center.rb
|
203
|
+
- spec/factories/group.rb
|
204
|
+
- spec/factories/tax.rb
|
205
|
+
- spec/group_spec.rb
|
206
|
+
- spec/groups_creator_spec.rb
|
207
|
+
- spec/journal_spec.rb
|
208
|
+
- spec/posting_spec.rb
|
209
|
+
- spec/spec_helper.rb
|
210
|
+
- spec/support/document.rb
|
211
|
+
- spec/support/ledger.rb
|
212
|
+
- spec/support/spec_migration.rb
|
213
|
+
- spec/tax_spec.rb
|