blawzoo-plutus 0.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. data/.yardopts +2 -0
  2. data/LICENSE +23 -0
  3. data/README.markdown +197 -0
  4. data/Rakefile +11 -0
  5. data/VERSION.yml +5 -0
  6. data/app/controllers/accounts_controller.rb +43 -0
  7. data/app/controllers/transactions_controller.rb +42 -0
  8. data/app/models/account.rb +57 -0
  9. data/app/models/asset.rb +81 -0
  10. data/app/models/equity.rb +82 -0
  11. data/app/models/expense.rb +81 -0
  12. data/app/models/liability.rb +76 -0
  13. data/app/models/revenue.rb +81 -0
  14. data/app/models/transaction.rb +27 -0
  15. data/app/views/accounts/index.html.erb +27 -0
  16. data/app/views/accounts/show.html.erb +69 -0
  17. data/app/views/layouts/accounts.html.erb +68 -0
  18. data/app/views/layouts/transactions.html.erb +68 -0
  19. data/app/views/transactions/index.html.erb +27 -0
  20. data/app/views/transactions/show.html.erb +24 -0
  21. data/doc/Account.html +300 -0
  22. data/doc/AccountsController.html +317 -0
  23. data/doc/Asset.html +610 -0
  24. data/doc/Equity.html +610 -0
  25. data/doc/Expense.html +610 -0
  26. data/doc/Liability.html +588 -0
  27. data/doc/Revenue.html +610 -0
  28. data/doc/Transaction.html +156 -0
  29. data/doc/TransactionsController.html +317 -0
  30. data/doc/_index.html +204 -0
  31. data/doc/class_list.html +36 -0
  32. data/doc/file.README.html +250 -0
  33. data/doc/file_list.html +38 -0
  34. data/doc/frames.html +13 -0
  35. data/doc/index.html +250 -0
  36. data/doc/js/app.js +202 -0
  37. data/doc/js/full_list.js +149 -0
  38. data/doc/js/jquery.js +154 -0
  39. data/doc/method_list.html +275 -0
  40. data/doc/top-level-namespace.html +90 -0
  41. data/lib/plutus.rb +6 -0
  42. data/plutus.gemspec +116 -0
  43. data/spec/controllers/accounts_controller_spec.rb +26 -0
  44. data/spec/controllers/transactions_controller_spec.rb +26 -0
  45. data/spec/factories/account_factory.rb +31 -0
  46. data/spec/factories/transaction_factory.rb +6 -0
  47. data/spec/lib/plutus_spec.rb +0 -0
  48. data/spec/models/account_spec.rb +43 -0
  49. data/spec/models/asset_spec.rb +46 -0
  50. data/spec/models/equity_spec.rb +46 -0
  51. data/spec/models/expense_spec.rb +46 -0
  52. data/spec/models/liability_spec.rb +46 -0
  53. data/spec/models/revenue_spec.rb +46 -0
  54. data/spec/models/transaction_spec.rb +48 -0
  55. data/spec/rcov.opts +2 -0
  56. data/spec/routing/accounts_routing_spec.rb +30 -0
  57. data/spec/routing/transactions_routing_spec.rb +30 -0
  58. data/spec/schema.rb +31 -0
  59. data/spec/spec.opts +4 -0
  60. data/spec/spec_helper.rb +14 -0
  61. data/tasks/plutus_tasks.rake +4 -0
  62. metadata +204 -0
@@ -0,0 +1,46 @@
1
+ require 'spec_helper'
2
+
3
+ describe Expense do
4
+
5
+ it "should allow creating an expense account" do
6
+ expense = Factory(:expense)
7
+ end
8
+
9
+ it "should report a balance for the expense account" do
10
+ expense = Factory(:expense)
11
+ expense.balance.should be_kind_of(BigDecimal)
12
+ end
13
+
14
+ it "should report a balance for the class of accounts" do
15
+ Expense.should respond_to(:balance)
16
+ Expense.balance.should be_kind_of(BigDecimal)
17
+ end
18
+
19
+ it "should not report a trial balance" do
20
+ lambda{Expense.trial_balance}.should raise_error(NoMethodError)
21
+ end
22
+
23
+ it "should not be valid without a name" do
24
+ expense = Factory.build(:expense, :name => nil)
25
+ expense.should_not be_valid
26
+ end
27
+
28
+ it "should have many credit transactions" do
29
+ expense = Factory(:expense)
30
+ expense.should respond_to(:credit_transactions)
31
+ end
32
+
33
+ it "should have many debit transactions" do
34
+ expense = Factory(:expense)
35
+ expense.should respond_to(:debit_transactions)
36
+ end
37
+
38
+ it "a contra account should reverse the normal balance" do
39
+ expense = Factory(:expense)
40
+ contra_expense = Factory(:expense, :contra => true)
41
+ transaction = Factory(:transaction, :credit_account => contra_expense, :debit_account => expense, :amount => 1000)
42
+ contra_expense.balance.should > 0
43
+ Expense.balance.should == 0
44
+ end
45
+
46
+ end
@@ -0,0 +1,46 @@
1
+ require 'spec_helper'
2
+
3
+ describe Liability do
4
+
5
+ it "should allow creating a liability account" do
6
+ liability = Factory(:liability)
7
+ end
8
+
9
+ it "should report a balance for the liability account" do
10
+ liability = Factory(:liability)
11
+ liability.balance.should be_kind_of(BigDecimal)
12
+ end
13
+
14
+ it "should report a balance for the class of accounts" do
15
+ Liability.should respond_to(:balance)
16
+ Liability.balance.should be_kind_of(BigDecimal)
17
+ end
18
+
19
+ it "should not report a trial balance" do
20
+ lambda{Liability.trial_balance}.should raise_error(NoMethodError)
21
+ end
22
+
23
+ it "should not be valid without a name" do
24
+ liability = Factory.build(:liability, :name => nil)
25
+ liability.should_not be_valid
26
+ end
27
+
28
+ it "should have many credit transactions" do
29
+ liability = Factory(:liability)
30
+ liability.should respond_to(:credit_transactions)
31
+ end
32
+
33
+ it "should have many debit transactions" do
34
+ liability = Factory(:liability)
35
+ liability.should respond_to(:debit_transactions)
36
+ end
37
+
38
+ it "a contra account should reverse the normal balance" do
39
+ liability = Factory(:liability)
40
+ contra_liability = Factory(:liability, :contra => true)
41
+ transaction = Factory(:transaction, :credit_account => liability, :debit_account => contra_liability, :amount => 1000)
42
+ contra_liability.balance.should > 0
43
+ Liability.balance.should == 0
44
+ end
45
+
46
+ end
@@ -0,0 +1,46 @@
1
+ require 'spec_helper'
2
+
3
+ describe Revenue do
4
+
5
+ it "should allow creating a revenue account" do
6
+ revenue = Factory(:revenue)
7
+ end
8
+
9
+ it "should report a balance for the revenue account" do
10
+ revenue = Factory(:revenue)
11
+ revenue.balance.should be_kind_of(BigDecimal)
12
+ end
13
+
14
+ it "should report a balance for the class of accounts" do
15
+ Revenue.should respond_to(:balance)
16
+ Revenue.balance.should be_kind_of(BigDecimal)
17
+ end
18
+
19
+ it "should not report a trial balance" do
20
+ lambda{Revenue.trial_balance}.should raise_error(NoMethodError)
21
+ end
22
+
23
+ it "should not be valid without a name" do
24
+ revenue = Factory.build(:revenue, :name => nil)
25
+ revenue.should_not be_valid
26
+ end
27
+
28
+ it "should have many credit transactions" do
29
+ revenue = Factory(:revenue)
30
+ revenue.should respond_to(:credit_transactions)
31
+ end
32
+
33
+ it "should have many debit transactions" do
34
+ revenue = Factory(:revenue)
35
+ revenue.should respond_to(:debit_transactions)
36
+ end
37
+
38
+ it "a contra account should reverse the normal balance" do
39
+ revenue = Factory(:revenue)
40
+ contra_revenue = Factory(:revenue, :contra => true)
41
+ transaction = Factory(:transaction, :credit_account => revenue, :debit_account => contra_revenue, :amount => 1000)
42
+ contra_revenue.balance.should > 0
43
+ Revenue.balance.should == 0
44
+ end
45
+
46
+ end
@@ -0,0 +1,48 @@
1
+ require 'spec_helper'
2
+
3
+ describe Transaction do
4
+
5
+ it "should create a transaction" do
6
+ transaction = Factory(:transaction)
7
+ end
8
+
9
+ it "should not be valid without a credit account" do
10
+ transaction = Factory.build(:transaction, :credit_account => nil)
11
+ transaction.should_not be_valid
12
+ end
13
+
14
+ it "should not be valid without a valid credit account" do
15
+ bad_account = Factory.build(:asset, :name => nil)
16
+ transaction = Factory.build(:transaction, :credit_account => bad_account)
17
+ transaction.should_not be_valid
18
+ end
19
+
20
+ it "should not be valid without a debit account" do
21
+ transaction = Factory.build(:transaction, :debit_account => nil)
22
+ transaction.should_not be_valid
23
+ end
24
+
25
+ it "should not be valid without a valid credit account" do
26
+ bad_account = Factory.build(:asset, :name => nil)
27
+ transaction = Factory.build(:transaction, :debit_account => bad_account)
28
+ transaction.should_not be_valid
29
+ end
30
+
31
+ it "should not be valid without an amount" do
32
+ transaction = Factory.build(:transaction, :amount => nil)
33
+ transaction.should_not be_valid
34
+ end
35
+
36
+ it "should not be valid without a description" do
37
+ transaction = Factory.build(:transaction, :description => nil)
38
+ transaction.should_not be_valid
39
+ end
40
+
41
+ it "should have a polymorphic commercial document associations" do
42
+ mock_document = Factory(:transaction) # one would never do this, but it allows us to not require a migration for the test
43
+ transaction = Factory(:transaction, :commercial_document => mock_document)
44
+ saved_transaction = Transaction.find(transaction.id)
45
+ saved_transaction.commercial_document.should == mock_document
46
+ end
47
+
48
+ end
@@ -0,0 +1,2 @@
1
+ --exclude "spec/*,gems/*"
2
+ --rails
@@ -0,0 +1,30 @@
1
+ require 'spec_helper'
2
+
3
+ describe AccountsController do
4
+ # Run these tests if you enable routing in your rails app. See README
5
+ #describe "routing" do
6
+ #it "recognizes and generates #index" do
7
+ #{ :get => "/accounts" }.should route_to(:controller => "accounts", :action => "index")
8
+ #end
9
+
10
+ #it "recognizes and generates #show" do
11
+ #{ :get => "/accounts/1" }.should route_to(:controller => "accounts", :action => "show", :id => "1")
12
+ #end
13
+
14
+ #it "recognizes and generates #edit" do
15
+ #{ :get => "/accounts/1/edit" }.should_not be_routable
16
+ #end
17
+
18
+ #it "recognizes and generates #create" do
19
+ #{ :post => "/accounts" }.should_not be_routable
20
+ #end
21
+
22
+ #it "recognizes and generates #update" do
23
+ #{ :put => "/accounts/1" }.should_not be_routable
24
+ #end
25
+
26
+ #it "recognizes and generates #destroy" do
27
+ #{ :delete => "/accounts/1" }.should_not be_routable
28
+ #end
29
+ #end
30
+ end
@@ -0,0 +1,30 @@
1
+ require 'spec_helper'
2
+
3
+ describe TransactionsController do
4
+ # Run these tests if you enable routing in your rails app. See README
5
+ #describe "routing" do
6
+ #it "recognizes and generates #index" do
7
+ #{ :get => "/transactions" }.should route_to(:controller => "transactions", :action => "index")
8
+ #end
9
+
10
+ #it "recognizes and generates #show" do
11
+ #{ :get => "/transactions/1" }.should route_to(:controller => "transactions", :action => "show", :id => "1")
12
+ #end
13
+
14
+ #it "recognizes and generates #edit" do
15
+ #{ :get => "/transactions/1/edit" }.should_not be_routable
16
+ #end
17
+
18
+ #it "recognizes and generates #create" do
19
+ #{ :post => "/transactions" }.should_not be_routable
20
+ #end
21
+
22
+ #it "recognizes and generates #update" do
23
+ #{ :put => "/transactions/1" }.should_not be_routable
24
+ #end
25
+
26
+ #it "recognizes and generates #destroy" do
27
+ #{ :delete => "/transactions/1" }.should_not be_routable
28
+ #end
29
+ #end
30
+ end
@@ -0,0 +1,31 @@
1
+ # This file is auto-generated from the current state of the database. Instead of editing this file,
2
+ # please use the migrations feature of Active Record to incrementally modify your database, and
3
+ # then regenerate this schema definition.
4
+ #
5
+ # Note that this schema.rb definition is the authoritative source for your database schema. If you need
6
+ # to create the application database on another system, you should be using db:schema:load, not running
7
+ # all the migrations from scratch. The latter is a flawed and unsustainable approach (the more migrations
8
+ # you'll amass, the slower it'll run and the greater likelihood for issues).
9
+ #
10
+ # It's strongly recommended to check this file into your version control system.
11
+
12
+ ActiveRecord::Schema.define(:version => 20100419190249) do
13
+
14
+ create_table "accounts", :force => true do |t|
15
+ t.string "name"
16
+ t.string "type"
17
+ t.datetime "created_at"
18
+ t.datetime "updated_at"
19
+ end
20
+
21
+ create_table "transactions", :force => true do |t|
22
+ t.string "description"
23
+ t.integer "credit_account_id"
24
+ t.decimal "credit_amount"
25
+ t.integer "debit_account_id"
26
+ t.decimal "debit_amount"
27
+ t.datetime "created_at"
28
+ t.datetime "updated_at"
29
+ end
30
+
31
+ end
@@ -0,0 +1,4 @@
1
+ --colour
2
+ --format progress
3
+ --loadby mtime
4
+ --reverse
@@ -0,0 +1,14 @@
1
+ require 'factory_girl'
2
+
3
+ ENV["RAILS_ENV"] ||= 'test'
4
+ require File.expand_path(File.dirname(__FILE__) + "/../fixture_rails_root/config/environment")
5
+ require 'rspec/rails'
6
+
7
+ $: << File.expand_path(File.dirname(__FILE__) + '/../lib/')
8
+ require 'plutus'
9
+
10
+ Dir[File.expand_path(File.join(File.dirname(__FILE__),'factories','**','*.rb'))].each {|f| require f}
11
+
12
+ RSpec.configure do |config|
13
+ config.use_transactional_fixtures = true
14
+ end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :plutus do
3
+ # # Task goes here
4
+ # end
metadata ADDED
@@ -0,0 +1,204 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: blawzoo-plutus
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.5.3
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Michael Bulat
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2011-03-31 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rails
16
+ requirement: &2151893560 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '3.0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *2151893560
25
+ - !ruby/object:Gem::Dependency
26
+ name: sqlite3
27
+ requirement: &2151892540 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ type: :development
34
+ prerelease: false
35
+ version_requirements: *2151892540
36
+ - !ruby/object:Gem::Dependency
37
+ name: rspec
38
+ requirement: &2151891280 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ~>
42
+ - !ruby/object:Gem::Version
43
+ version: '2.6'
44
+ type: :development
45
+ prerelease: false
46
+ version_requirements: *2151891280
47
+ - !ruby/object:Gem::Dependency
48
+ name: rspec-rails
49
+ requirement: &2151889980 !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: '2.6'
55
+ type: :development
56
+ prerelease: false
57
+ version_requirements: *2151889980
58
+ - !ruby/object:Gem::Dependency
59
+ name: rspec-rails
60
+ requirement: &2151887940 !ruby/object:Gem::Requirement
61
+ none: false
62
+ requirements:
63
+ - - ~>
64
+ - !ruby/object:Gem::Version
65
+ version: '2.6'
66
+ type: :development
67
+ prerelease: false
68
+ version_requirements: *2151887940
69
+ - !ruby/object:Gem::Dependency
70
+ name: factory_girl
71
+ requirement: &2151887040 !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ! '>='
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: *2151887040
80
+ - !ruby/object:Gem::Dependency
81
+ name: factory_girl_rails
82
+ requirement: &2151884400 !ruby/object:Gem::Requirement
83
+ none: false
84
+ requirements:
85
+ - - ~>
86
+ - !ruby/object:Gem::Version
87
+ version: '1.1'
88
+ type: :development
89
+ prerelease: false
90
+ version_requirements: *2151884400
91
+ description: The plutus plugin provides a complete double entry accounting system
92
+ for use in any Ruby on Rails application. The plugin follows general Double Entry
93
+ Bookkeeping practices. All calculations are done using BigDecimal in order to prevent
94
+ floating point rounding errors. The plugin requires a decimal type on your database
95
+ as well.
96
+ email: mbulat@crazydogsoftware.com
97
+ executables: []
98
+ extensions: []
99
+ extra_rdoc_files:
100
+ - LICENSE
101
+ - README.markdown
102
+ files:
103
+ - .yardopts
104
+ - LICENSE
105
+ - README.markdown
106
+ - Rakefile
107
+ - VERSION.yml
108
+ - app/controllers/accounts_controller.rb
109
+ - app/controllers/transactions_controller.rb
110
+ - app/models/account.rb
111
+ - app/models/asset.rb
112
+ - app/models/equity.rb
113
+ - app/models/expense.rb
114
+ - app/models/liability.rb
115
+ - app/models/revenue.rb
116
+ - app/models/transaction.rb
117
+ - app/views/accounts/index.html.erb
118
+ - app/views/accounts/show.html.erb
119
+ - app/views/layouts/accounts.html.erb
120
+ - app/views/layouts/transactions.html.erb
121
+ - app/views/transactions/index.html.erb
122
+ - app/views/transactions/show.html.erb
123
+ - doc/Account.html
124
+ - doc/AccountsController.html
125
+ - doc/Asset.html
126
+ - doc/Equity.html
127
+ - doc/Expense.html
128
+ - doc/Liability.html
129
+ - doc/Revenue.html
130
+ - doc/Transaction.html
131
+ - doc/TransactionsController.html
132
+ - doc/_index.html
133
+ - doc/class_list.html
134
+ - doc/file.README.html
135
+ - doc/file_list.html
136
+ - doc/frames.html
137
+ - doc/index.html
138
+ - doc/js/app.js
139
+ - doc/js/full_list.js
140
+ - doc/js/jquery.js
141
+ - doc/method_list.html
142
+ - doc/top-level-namespace.html
143
+ - lib/plutus.rb
144
+ - plutus.gemspec
145
+ - spec/controllers/accounts_controller_spec.rb
146
+ - spec/controllers/transactions_controller_spec.rb
147
+ - spec/factories/account_factory.rb
148
+ - spec/factories/transaction_factory.rb
149
+ - spec/lib/plutus_spec.rb
150
+ - spec/models/account_spec.rb
151
+ - spec/models/asset_spec.rb
152
+ - spec/models/equity_spec.rb
153
+ - spec/models/expense_spec.rb
154
+ - spec/models/liability_spec.rb
155
+ - spec/models/revenue_spec.rb
156
+ - spec/models/transaction_spec.rb
157
+ - spec/rcov.opts
158
+ - spec/routing/accounts_routing_spec.rb
159
+ - spec/routing/transactions_routing_spec.rb
160
+ - spec/schema.rb
161
+ - spec/spec.opts
162
+ - spec/spec_helper.rb
163
+ - tasks/plutus_tasks.rake
164
+ homepage:
165
+ licenses: []
166
+ post_install_message:
167
+ rdoc_options: []
168
+ require_paths:
169
+ - lib
170
+ required_ruby_version: !ruby/object:Gem::Requirement
171
+ none: false
172
+ requirements:
173
+ - - ! '>='
174
+ - !ruby/object:Gem::Version
175
+ version: '0'
176
+ required_rubygems_version: !ruby/object:Gem::Requirement
177
+ none: false
178
+ requirements:
179
+ - - ! '>='
180
+ - !ruby/object:Gem::Version
181
+ version: 1.3.6
182
+ requirements: []
183
+ rubyforge_project:
184
+ rubygems_version: 1.8.10
185
+ signing_key:
186
+ specification_version: 3
187
+ summary: A Plugin providing a Double Entry Accounting Engine for Rails
188
+ test_files:
189
+ - spec/controllers/accounts_controller_spec.rb
190
+ - spec/controllers/transactions_controller_spec.rb
191
+ - spec/factories/account_factory.rb
192
+ - spec/factories/transaction_factory.rb
193
+ - spec/lib/plutus_spec.rb
194
+ - spec/models/account_spec.rb
195
+ - spec/models/asset_spec.rb
196
+ - spec/models/equity_spec.rb
197
+ - spec/models/expense_spec.rb
198
+ - spec/models/liability_spec.rb
199
+ - spec/models/revenue_spec.rb
200
+ - spec/models/transaction_spec.rb
201
+ - spec/routing/accounts_routing_spec.rb
202
+ - spec/routing/transactions_routing_spec.rb
203
+ - spec/schema.rb
204
+ - spec/spec_helper.rb