acts_as_account 3.2.0 → 3.2.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: b705a667091596f33080e44a576596290391e8c6
4
- data.tar.gz: b6d4dc031e53a8bc5b75051906aff81fb68081b6
2
+ SHA256:
3
+ metadata.gz: 6c6d94c77b41055a293cb92db325121dd8e40a9de54004ba017fd20bc301b243
4
+ data.tar.gz: '0582774b247afe230b9036f47fcea99d346f56993174fa9d4eac36e4ec817893'
5
5
  SHA512:
6
- metadata.gz: 9c1eeb4b0f460d5f53293e5a90bd0d06c088a8cddb9dbc2a077a470b70748bf9269ff7a76700e0b9ffa999c19ab119e823ec669f09046eb83226e6c36c058820
7
- data.tar.gz: 2a029a58a6e83a79a2101eb17c845b7d1fd59b68cb7b1cdcacff279b3ebbfd97c2de75a5b864572cbf696fb87a6df6d6eb39d3840eca69907590c608f5486640
6
+ metadata.gz: a41ef812cff3dfeca6b723ae5367baa3af018687e3316b03b6a39ad76bcd1d1dbf3a92e0f9efdf863c4f41930c41e518dbf0c4909357b780829673da72c330d7
7
+ data.tar.gz: f9ad1dc779fa5fd623491d9267465a486ee6bc03ece7839f0dd9c6a88d5b05574249278a3e2fe8776c01180c441451194d7e3b6b33070d24473a6a10c077ca3d
@@ -0,0 +1,29 @@
1
+ # based on https://github.com/rails/rails/blob/4a78dcb/.github/workflows/rubocop.yml
2
+
3
+ name: rubocop linting
4
+
5
+ on: [push, pull_request]
6
+
7
+ jobs:
8
+ build:
9
+ runs-on: ubuntu-latest
10
+
11
+ steps:
12
+ - uses: actions/checkout@v2
13
+ - name: Set up Ruby
14
+ uses: ruby/setup-ruby@v1
15
+ with:
16
+ ruby-version: 2.7
17
+ - name: Cache gems
18
+ uses: actions/cache@v1
19
+ with:
20
+ path: vendor/bundle
21
+ key: ${{ runner.os }}-rubocop-${{ hashFiles('**/Gemfile.lock') }}
22
+ restore-keys: |
23
+ ${{ runner.os }}-rubocop-
24
+ - name: Install gems
25
+ run: |
26
+ bundle config path vendor/bundle
27
+ bundle install --jobs 4 --retry 3
28
+ - name: Run rubocop
29
+ run: bundle exec rubocop --lint
@@ -0,0 +1,22 @@
1
+ name: tests
2
+
3
+ on: [push, pull_request]
4
+
5
+ jobs:
6
+ build:
7
+ runs-on: ubuntu-latest
8
+
9
+ strategy:
10
+ matrix:
11
+ ruby: [ '2.7', 'ruby-head' ]
12
+
13
+ steps:
14
+ - uses: actions/checkout@v2
15
+ - name: Set up Ruby ${{ matrix.ruby }}
16
+ uses: ruby/setup-ruby@v1
17
+ with:
18
+ ruby-version: ${{ matrix.ruby }}
19
+ - name: Install dependencies
20
+ run: bundle install --jobs 4
21
+ - name: Test with Rake
22
+ run: bundle exec rake
data/.rubocop.yml ADDED
@@ -0,0 +1,61 @@
1
+ # usage: `rubocop --lint`
2
+
3
+ AllCops:
4
+ NewCops: enable
5
+
6
+ # disable some linters that are not so likely to indicate bugs
7
+
8
+ Lint/AmbiguousAssignment:
9
+ Enabled: false
10
+ Lint/AmbiguousBlockAssociation:
11
+ Enabled: false
12
+ Lint/AmbiguousOperator:
13
+ Enabled: false
14
+ Lint/AmbiguousRegexpLiteral:
15
+ Enabled: false
16
+ Lint/AssignmentInCondition:
17
+ Enabled: false
18
+ Lint/ConstantDefinitionInBlock:
19
+ Enabled: false
20
+ Lint/ConstantResolution:
21
+ Enabled: false
22
+ Lint/DuplicateBranch:
23
+ Enabled: false
24
+ Lint/EmptyBlock:
25
+ Enabled: false
26
+ Lint/EmptyClass:
27
+ Enabled: false
28
+ Lint/EmptyConditionalBody:
29
+ Enabled: false
30
+ Lint/EmptyExpression:
31
+ Enabled: false
32
+ Lint/EmptyFile:
33
+ Enabled: false
34
+ Lint/EmptyWhen:
35
+ Enabled: false
36
+ Lint/EnsureReturn:
37
+ Enabled: false
38
+ Lint/Loop:
39
+ Enabled: false
40
+ Lint/MissingSuper:
41
+ Enabled: false
42
+ Lint/MixedRegexpCaptureTypes:
43
+ Enabled: false
44
+ Lint/NumberConversion:
45
+ Enabled: false
46
+ Lint/ParenthesesAsGroupedExpression:
47
+ Enabled: false
48
+ Lint/RedundantStringCoercion:
49
+ Enabled: false
50
+ Lint/ShadowedArgument:
51
+ Enabled: false
52
+ Lint/ShadowedException:
53
+ Enabled: false
54
+ Lint/ShadowingOuterLocalVariable:
55
+ Enabled: false
56
+ Lint/SuppressedException:
57
+ Enabled: false
58
+ Lint/UnusedBlockArgument:
59
+ Enabled: false
60
+ Lint/UnusedMethodArgument:
61
+ Enabled: false
data/README.md ADDED
@@ -0,0 +1,43 @@
1
+ # acts_as_account
2
+
3
+ [![Build Status](https://github.com/betterplace/acts_as_account/workflows/tests/badge.svg)](https://github.com/jaynetics/js_regex/actions)
4
+
5
+ ## Theory
6
+
7
+ *ActsAsAccount* implements a "Double Entry Accounting" system for your
8
+ Rails-models.
9
+
10
+ It hooks into ActiveRecord and allows to add accounts to any model by
11
+ simply means of adding `has_account` to your model. Because the accounts
12
+ are connected via a `has_many` relation no migration to the account-holder
13
+ tables is needed.
14
+
15
+ We also hook into the ActionController request cycle to warn the developer
16
+ if a request has left uncommitted changes in the system.
17
+
18
+ ## How to test
19
+
20
+ Run the cucumber features from the acs_as_account gem, just execute
21
+ * `rake features:create_database`
22
+ * `cucumber`
23
+
24
+ ## How to release
25
+
26
+ You need to update the data in `VERSION` and Rakefile and run `rake` (because it uses Gemhadar).
27
+ `rake gem:push` will push the version to rubygems.
28
+
29
+ ## Links
30
+
31
+ * Double Entry Accounting in a Relational Database: [http://homepages.tcp.co.uk/~m-wigley/gc_wp_ded.html (archived)](https://web.archive.org/web/20080310200243/http://homepages.tcp.co.uk/~m-wigley/gc_wp_ded.html)
32
+
33
+ ## Compatibility
34
+
35
+ Rails 4 is supported since version 3.1.0, Rails 7 since 3.2.2 .
36
+
37
+ ## Credits
38
+
39
+ This gem was written for the payment backend of betterplace.org by [Thies C. Arntzen, "thieso2"](https://github.com/thieso2), [Norman Timmler, "unnu"](https://github.com/unnu) and others.
40
+
41
+ ## Copyright
42
+
43
+ Copyright (c) 2010, 2022 [gut.org gAG](https://gut.org), released under the [Apache License v2.0](LICENSE).
data/Rakefile CHANGED
@@ -6,43 +6,38 @@ GemHadar do
6
6
  name 'acts_as_account'
7
7
  author [ "Thies C. Arntzen, Norman Timmler, Matthias Frick, Phillip Oertel" ]
8
8
  email 'developers@betterplace.org'
9
- homepage "http://github.com/betterplace/acts_as_account"
9
+ homepage "https://github.com/betterplace/acts_as_account"
10
10
  summary 'acts_as_account implements double entry accounting for Rails models'
11
11
  description 'acts_as_account implements double entry accounting for Rails models. Your models get accounts and you can do consistent transactions between them. Since the documentation is sparse, see the transfer.feature for usage examples.'
12
12
  test_dir 'tests'
13
13
  ignore '.*.sw[pon]', 'pkg', 'Gemfile.lock', 'coverage', '.rvmrc',
14
14
  '.AppleDouble', 'tags', '.byebug_history', '.DS_Store'
15
- readme 'README.rdoc'
15
+ readme 'README.md'
16
16
  title "#{name.camelize} -- More Math in Ruby"
17
17
  licenses << 'Apache-2.0'
18
18
 
19
- dependency 'activerecord', '>= 4.1', '<6'
20
- dependency 'actionpack' , '>= 4.1', '<6'
21
- dependency 'database_cleaner', '~> 1.3'
19
+ dependency 'activerecord', '>= 5.1', '<8'
20
+ dependency 'actionpack' , '>= 4.1', '<8'
22
21
  development_dependency 'cucumber', '~> 1.3'
23
- development_dependency 'mysql2'
22
+ development_dependency 'sqlite3'
24
23
  development_dependency 'rspec', '~> 3.1'
25
24
  development_dependency 'simplecov'
26
- development_dependency 'complex_config'
25
+ development_dependency 'database_cleaner', '~> 1.3'
26
+ development_dependency 'rubocop'
27
27
  end
28
28
 
29
29
  def connect_database
30
30
  require 'active_record'
31
- require 'complex_config'
32
- config = ComplexConfig::Provider.config 'features/db/database.yml'
33
- connection_config = config.acts_as_account.to_h
34
- connection_config.delete(:database)
35
- ActiveRecord::Base.establish_connection(connection_config).connection
31
+ require 'yaml'
32
+ db_config = YAML.load_file('features/db/database.yml')
33
+ ActiveRecord::Base.establish_connection(db_config).connection
36
34
  end
37
35
 
38
36
  namespace :features do
39
37
  desc "create test database out of db/schema.rb"
40
38
  task :create_database do
41
- conn = connect_database
42
- conn.execute('DROP DATABASE IF EXISTS acts_as_account')
43
- conn.execute('CREATE DATABASE acts_as_account')
44
- conn.execute('USE acts_as_account')
45
- load(File.dirname(__FILE__) + '/features/db/schema.rb')
39
+ connect_database
40
+ load("#{__dir__}/features/db/schema.rb")
46
41
  end
47
42
  end
48
43
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.2.0
1
+ 3.2.3
@@ -1,57 +1,47 @@
1
1
  # -*- encoding: utf-8 -*-
2
- # stub: acts_as_account 3.2.0 ruby lib
2
+ # stub: acts_as_account 3.2.3 ruby lib
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "acts_as_account".freeze
6
- s.version = "3.2.0"
6
+ s.version = "3.2.3"
7
7
 
8
8
  s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
9
9
  s.require_paths = ["lib".freeze]
10
10
  s.authors = ["Thies C. Arntzen, Norman Timmler, Matthias Frick, Phillip Oertel".freeze]
11
- s.date = "2016-12-08"
11
+ s.date = "2022-07-20"
12
12
  s.description = "acts_as_account implements double entry accounting for Rails models. Your models get accounts and you can do consistent transactions between them. Since the documentation is sparse, see the transfer.feature for usage examples.".freeze
13
13
  s.email = "developers@betterplace.org".freeze
14
- s.extra_rdoc_files = ["README.rdoc".freeze, "lib/acts_as_account.rb".freeze, "lib/acts_as_account/account.rb".freeze, "lib/acts_as_account/active_record_extensions.rb".freeze, "lib/acts_as_account/global_account.rb".freeze, "lib/acts_as_account/journal.rb".freeze, "lib/acts_as_account/manually_created_account.rb".freeze, "lib/acts_as_account/posting.rb".freeze, "lib/acts_as_account/rails.rb".freeze, "lib/acts_as_account/transfer.rb".freeze, "lib/acts_as_account/version.rb".freeze]
15
- s.files = [".gitignore".freeze, ".travis.yml".freeze, "CHANGELOG.md".freeze, "Gemfile".freeze, "LICENSE".freeze, "README.rdoc".freeze, "Rakefile".freeze, "VERSION".freeze, "acts_as_account.gemspec".freeze, "cucumber.yml".freeze, "features/account/account_creation.feature".freeze, "features/db/database.yml".freeze, "features/db/schema.rb".freeze, "features/step_definitions/account_steps.rb".freeze, "features/support/abstract_user.rb".freeze, "features/support/cheque.rb".freeze, "features/support/env.rb".freeze, "features/support/inheriting_user.rb".freeze, "features/support/user.rb".freeze, "features/transfer/journal_creation.feature".freeze, "features/transfer/transfer.feature".freeze, "init.rb".freeze, "lib/acts_as_account.rb".freeze, "lib/acts_as_account/account.rb".freeze, "lib/acts_as_account/active_record_extensions.rb".freeze, "lib/acts_as_account/global_account.rb".freeze, "lib/acts_as_account/journal.rb".freeze, "lib/acts_as_account/manually_created_account.rb".freeze, "lib/acts_as_account/posting.rb".freeze, "lib/acts_as_account/rails.rb".freeze, "lib/acts_as_account/transfer.rb".freeze, "lib/acts_as_account/version.rb".freeze]
16
- s.homepage = "http://github.com/betterplace/acts_as_account".freeze
14
+ s.extra_rdoc_files = ["README.md".freeze, "lib/acts_as_account.rb".freeze, "lib/acts_as_account/account.rb".freeze, "lib/acts_as_account/active_record_extensions.rb".freeze, "lib/acts_as_account/global_account.rb".freeze, "lib/acts_as_account/journal.rb".freeze, "lib/acts_as_account/manually_created_account.rb".freeze, "lib/acts_as_account/posting.rb".freeze, "lib/acts_as_account/rails.rb".freeze, "lib/acts_as_account/transfer.rb".freeze, "lib/acts_as_account/version.rb".freeze]
15
+ s.files = [".github/workflows/lint.yml".freeze, ".github/workflows/tests.yml".freeze, ".gitignore".freeze, ".rubocop.yml".freeze, "CHANGELOG.md".freeze, "Gemfile".freeze, "LICENSE".freeze, "README.md".freeze, "Rakefile".freeze, "VERSION".freeze, "acts_as_account.gemspec".freeze, "acts_as_account.sqlite".freeze, "cucumber.yml".freeze, "features/account/account_creation.feature".freeze, "features/db/database.yml".freeze, "features/db/schema.rb".freeze, "features/step_definitions/account_steps.rb".freeze, "features/support/abstract_user.rb".freeze, "features/support/cheque.rb".freeze, "features/support/env.rb".freeze, "features/support/inheriting_user.rb".freeze, "features/support/user.rb".freeze, "features/transfer/journal_creation.feature".freeze, "features/transfer/transfer.feature".freeze, "init.rb".freeze, "lib/acts_as_account.rb".freeze, "lib/acts_as_account/account.rb".freeze, "lib/acts_as_account/active_record_extensions.rb".freeze, "lib/acts_as_account/global_account.rb".freeze, "lib/acts_as_account/journal.rb".freeze, "lib/acts_as_account/manually_created_account.rb".freeze, "lib/acts_as_account/posting.rb".freeze, "lib/acts_as_account/rails.rb".freeze, "lib/acts_as_account/transfer.rb".freeze, "lib/acts_as_account/version.rb".freeze]
16
+ s.homepage = "https://github.com/betterplace/acts_as_account".freeze
17
17
  s.licenses = ["Apache-2.0".freeze]
18
- s.rdoc_options = ["--title".freeze, "ActsAsAccount -- More Math in Ruby".freeze, "--main".freeze, "README.rdoc".freeze]
19
- s.rubygems_version = "2.6.8".freeze
18
+ s.rdoc_options = ["--title".freeze, "ActsAsAccount -- More Math in Ruby".freeze, "--main".freeze, "README.md".freeze]
19
+ s.rubygems_version = "3.3.3".freeze
20
20
  s.summary = "acts_as_account implements double entry accounting for Rails models".freeze
21
21
 
22
22
  if s.respond_to? :specification_version then
23
23
  s.specification_version = 4
24
+ end
24
25
 
25
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
26
- s.add_development_dependency(%q<gem_hadar>.freeze, ["~> 1.9.1"])
27
- s.add_development_dependency(%q<cucumber>.freeze, ["~> 1.3"])
28
- s.add_development_dependency(%q<mysql2>.freeze, [">= 0"])
29
- s.add_development_dependency(%q<rspec>.freeze, ["~> 3.1"])
30
- s.add_development_dependency(%q<simplecov>.freeze, [">= 0"])
31
- s.add_development_dependency(%q<complex_config>.freeze, [">= 0"])
32
- s.add_runtime_dependency(%q<activerecord>.freeze, ["< 6", ">= 4.1"])
33
- s.add_runtime_dependency(%q<actionpack>.freeze, ["< 6", ">= 4.1"])
34
- s.add_runtime_dependency(%q<database_cleaner>.freeze, ["~> 1.3"])
35
- else
36
- s.add_dependency(%q<gem_hadar>.freeze, ["~> 1.9.1"])
37
- s.add_dependency(%q<cucumber>.freeze, ["~> 1.3"])
38
- s.add_dependency(%q<mysql2>.freeze, [">= 0"])
39
- s.add_dependency(%q<rspec>.freeze, ["~> 3.1"])
40
- s.add_dependency(%q<simplecov>.freeze, [">= 0"])
41
- s.add_dependency(%q<complex_config>.freeze, [">= 0"])
42
- s.add_dependency(%q<activerecord>.freeze, ["< 6", ">= 4.1"])
43
- s.add_dependency(%q<actionpack>.freeze, ["< 6", ">= 4.1"])
44
- s.add_dependency(%q<database_cleaner>.freeze, ["~> 1.3"])
45
- end
26
+ if s.respond_to? :add_runtime_dependency then
27
+ s.add_development_dependency(%q<gem_hadar>.freeze, ["~> 1.11.0"])
28
+ s.add_development_dependency(%q<cucumber>.freeze, ["~> 1.3"])
29
+ s.add_development_dependency(%q<sqlite3>.freeze, [">= 0"])
30
+ s.add_development_dependency(%q<rspec>.freeze, ["~> 3.1"])
31
+ s.add_development_dependency(%q<simplecov>.freeze, [">= 0"])
32
+ s.add_development_dependency(%q<database_cleaner>.freeze, ["~> 1.3"])
33
+ s.add_development_dependency(%q<rubocop>.freeze, [">= 0"])
34
+ s.add_runtime_dependency(%q<activerecord>.freeze, [">= 5.1", "< 8"])
35
+ s.add_runtime_dependency(%q<actionpack>.freeze, [">= 4.1", "< 8"])
46
36
  else
47
- s.add_dependency(%q<gem_hadar>.freeze, ["~> 1.9.1"])
37
+ s.add_dependency(%q<gem_hadar>.freeze, ["~> 1.11.0"])
48
38
  s.add_dependency(%q<cucumber>.freeze, ["~> 1.3"])
49
- s.add_dependency(%q<mysql2>.freeze, [">= 0"])
39
+ s.add_dependency(%q<sqlite3>.freeze, [">= 0"])
50
40
  s.add_dependency(%q<rspec>.freeze, ["~> 3.1"])
51
41
  s.add_dependency(%q<simplecov>.freeze, [">= 0"])
52
- s.add_dependency(%q<complex_config>.freeze, [">= 0"])
53
- s.add_dependency(%q<activerecord>.freeze, ["< 6", ">= 4.1"])
54
- s.add_dependency(%q<actionpack>.freeze, ["< 6", ">= 4.1"])
55
42
  s.add_dependency(%q<database_cleaner>.freeze, ["~> 1.3"])
43
+ s.add_dependency(%q<rubocop>.freeze, [">= 0"])
44
+ s.add_dependency(%q<activerecord>.freeze, [">= 5.1", "< 8"])
45
+ s.add_dependency(%q<actionpack>.freeze, [">= 4.1", "< 8"])
56
46
  end
57
47
  end
Binary file
@@ -1,6 +1,5 @@
1
- acts_as_account:
2
- adapter: mysql2
3
- encoding: utf8
4
- database: acts_as_account
5
- username: root
6
- host: localhost
1
+ adapter: sqlite3
2
+ encoding: utf8
3
+ database: acts_as_account.sqlite
4
+ username: root
5
+ host: localhost
@@ -1,69 +1,64 @@
1
- ActiveRecord::Schema.define(:version => 1) do
1
+ ActiveRecord::Schema.define(version: 1) do
2
2
  if ENV['DROP_FK']
3
3
  execute "ALTER TABLE acts_as_account_postings DROP FOREIGN KEY account_id"
4
4
  execute "ALTER TABLE acts_as_account_postings DROP FOREIGN KEY other_account_id"
5
5
  execute "ALTER TABLE acts_as_account_postings DROP FOREIGN KEY journal_id"
6
6
  end
7
-
8
- create_table "acts_as_account_accounts", :force => true do |t|
9
- t.integer "holder_id", :null => false
10
- t.string "holder_type", :null => false
11
- t.string "name", :null => false
12
-
13
- t.integer "balance", :default => 0
14
- t.integer "postings_count", :default => 0
15
- t.datetime "last_valuta"
16
-
17
- t.datetime "created_at"
18
- t.datetime "updated_at"
7
+
8
+ create_table "acts_as_account_accounts", force: true do |t|
9
+ t.belongs_to "holder", null: false
10
+ t.string "holder_type", null: false
11
+ t.string "name", null: false
12
+
13
+ t.integer "balance", default: 0
14
+ t.integer "postings_count", default: 0
15
+ t.datetime "last_valuta"
16
+
17
+ t.datetime "created_at"
18
+ t.datetime "updated_at"
19
19
  end
20
- add_index "acts_as_account_accounts", ["holder_id", "holder_type", "name"], :name => 'account_unique', :unique => true
20
+ add_index "acts_as_account_accounts", ["holder_id", "holder_type", "name"], name: 'account_unique', unique: true
21
21
 
22
- create_table "acts_as_account_journals", :force => true do |t|
22
+ create_table "acts_as_account_journals", force: true do |t|
23
23
  t.datetime "created_at"
24
24
  t.datetime "updated_at"
25
25
  end
26
26
 
27
- create_table "acts_as_account_postings", :force => true do |t|
28
- t.integer "account_id", :null => false
29
- t.integer "other_account_id", :null => false
30
- t.integer "journal_id", :null => false
31
- t.integer "amount", :null => false
32
-
33
- t.integer "reference_id"
34
- t.string "reference_type"
27
+ create_table "acts_as_account_postings", force: true do |t|
28
+ t.belongs_to "account", null: false, index: true
29
+ t.belongs_to "other_account", null: false
30
+ t.belongs_to "journal", null: false, index: true
31
+ t.integer "amount", null: false
35
32
 
36
- t.datetime "valuta"
33
+ t.belongs_to "reference"
34
+ t.string "reference_type"
37
35
 
38
- t.datetime "created_at"
39
- t.datetime "updated_at"
36
+ t.datetime "valuta"
37
+
38
+ t.datetime "created_at"
39
+ t.datetime "updated_at"
40
40
  end
41
- add_index "acts_as_account_postings", "account_id"
42
- add_index "acts_as_account_postings", "journal_id"
43
- add_index "acts_as_account_postings", ["reference_type", "reference_id"], :name => "reference"
44
- add_index "acts_as_account_postings", ["valuta", "id"], :name => "sort_key"
45
-
46
- execute "ALTER TABLE acts_as_account_postings ADD CONSTRAINT account_id FOREIGN KEY (account_id) REFERENCES acts_as_account_accounts (id)"
47
- execute "ALTER TABLE acts_as_account_postings ADD CONSTRAINT other_account_id FOREIGN KEY (other_account_id) REFERENCES acts_as_account_accounts (id)"
48
- execute "ALTER TABLE acts_as_account_postings ADD CONSTRAINT journal_id FOREIGN KEY (journal_id) REFERENCES acts_as_account_journals (id)"
41
+ add_index "acts_as_account_postings", ["reference_type", "reference_id"], name: "reference"
42
+ add_index "acts_as_account_postings", ["valuta", "id"], name: "sort_key"
49
43
 
50
- create_table "acts_as_account_global_accounts", :force => true do |t|
51
- t.string "name", :null => false
44
+ create_table "acts_as_account_global_accounts", force: true do |t|
45
+ t.string "name", null: false
52
46
  end
53
47
 
54
- create_table "users", :force => true do |t|
55
- t.string "name", :null => false
48
+ create_table "users", force: true do |t|
49
+ t.string "name", null: false
56
50
  t.datetime "created_at"
57
51
  t.datetime "updated_at"
58
52
  end
59
53
 
60
- create_table "abstract_users", :force => true do |t|
61
- t.string "name", :null => false
62
- t.string "type", :null => false
54
+ create_table "abstract_users", force: true do |t|
55
+ t.string "name", null: false
56
+ t.string "type", null: false
63
57
  t.datetime "created_at"
64
58
  t.datetime "updated_at"
65
59
  end
66
- create_table "cheques", :force => true do |t|
60
+
61
+ create_table "cheques", force: true do |t|
67
62
  t.string "number"
68
63
  t.datetime "created_at"
69
64
  t.datetime "updated_at"
@@ -2,6 +2,11 @@
2
2
 
3
3
  include ActsAsAccount
4
4
 
5
+ require 'rspec'
6
+ RSpec.configure do |config|
7
+ config.expect_with(:rspec) { |c| c.syntax = :should }
8
+ end
9
+
5
10
  def german_date_time_to_local(datestring, timestring)
6
11
  Time.local(*(datestring.split(".").reverse + timestring.split(":")).map(&:to_i))
7
12
  end
@@ -89,7 +94,7 @@ When /^I create a Journal via (.+)$/ do |method|
89
94
  eval <<-EOT
90
95
  @journal = Journal.#{method}
91
96
  EOT
92
- rescue Exception => @last_exception
97
+ rescue => @last_exception
93
98
  end
94
99
  end
95
100
 
@@ -147,7 +152,7 @@ end
147
152
 
148
153
  Then /^the order of the postings is correct$/ do
149
154
  # make sure we always book "Soll an Haben"
150
- Posting.all.in_groups_of(2) do |from, to|
155
+ Posting.all.each_slice(2) do |from, to|
151
156
  from.amount.should be < 0
152
157
  to.amount.should be > 0
153
158
  end
@@ -6,20 +6,20 @@ if ENV['START_SIMPLECOV'].to_i == 1
6
6
  end
7
7
 
8
8
  require 'acts_as_account'
9
- require 'complex_config'
10
- config =ComplexConfig::Provider.config File.dirname(__FILE__) + '/../db/database.yml'
11
- ActiveRecord::Base.establish_connection(config.acts_as_account.to_h)
9
+ require 'yaml'
10
+ db_config = YAML.load_file(__dir__ + '/../db/database.yml')
11
+ ActiveRecord::Base.establish_connection(db_config)
12
12
 
13
13
  require 'database_cleaner'
14
14
  require 'database_cleaner/cucumber'
15
15
  DatabaseCleaner.strategy = :transaction
16
16
 
17
- Dir[File.dirname(__FILE__) + '/../step_definitions/*.rb'].each { |file| require file }
17
+ Dir["#{__dir__}/../step_definitions/*.rb"].sort.each { |file| require file }
18
18
 
19
- require File.dirname(__FILE__) + '/user'
20
- require File.dirname(__FILE__) + '/abstract_user'
21
- require File.dirname(__FILE__) + '/inheriting_user'
22
- require File.dirname(__FILE__) + '/cheque'
19
+ require_relative 'user'
20
+ require_relative 'abstract_user'
21
+ require_relative 'inheriting_user'
22
+ require_relative 'cheque'
23
23
 
24
24
  After do
25
25
  ActsAsAccount::Journal.clear_current
@@ -53,7 +53,7 @@ module ActsAsAccount
53
53
  yield
54
54
 
55
55
  # Trying to create a duplicate key on a unique index raises StatementInvalid
56
- rescue ActiveRecord::StatementInvalid => e
56
+ rescue ActiveRecord::StatementInvalid
57
57
  record = if attributes[:holder]
58
58
  attributes[:holder].account(attributes[:name])
59
59
  else
@@ -21,7 +21,7 @@ module ActsAsAccount
21
21
 
22
22
  def transfers
23
23
  [].tap do |transfers|
24
- postings.in_groups_of(2) { |postings| transfers << Transfer.new(*postings) }
24
+ postings.each_slice(2) { |postings| transfers << Transfer.new(*postings) }
25
25
  end
26
26
  end
27
27
 
@@ -12,11 +12,11 @@ module ActsAsAccount
12
12
  scope :soll, -> { where('amount >= 0') }
13
13
  scope :haben, -> { where('amount < 0') }
14
14
  scope :start_date, -> date {
15
- date = Time.parse(date.to_s).utc.to_s(:db)
15
+ date = Time.parse(date.to_s).utc.to_fs(:db)
16
16
  where(['valuta >= ?', date])
17
17
  }
18
18
  scope :end_date, -> date {
19
- date = Time.parse(date.to_s).utc.to_s(:db)
19
+ date = Time.parse(date.to_s).utc.to_fs(:db)
20
20
  where(['valuta <= ?', date])
21
21
  }
22
22
  end
@@ -1,6 +1,6 @@
1
1
  module ActsAsAccount
2
2
  # ActsAsAccount version
3
- VERSION = '3.2.0'
3
+ VERSION = '3.2.3'
4
4
  VERSION_ARRAY = VERSION.split('.').map(&:to_i) # :nodoc:
5
5
  VERSION_MAJOR = VERSION_ARRAY[0] # :nodoc:
6
6
  VERSION_MINOR = VERSION_ARRAY[1] # :nodoc:
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: acts_as_account
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.0
4
+ version: 3.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thies C. Arntzen, Norman Timmler, Matthias Frick, Phillip Oertel
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-12-08 00:00:00.000000000 Z
11
+ date: 2022-07-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gem_hadar
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 1.9.1
19
+ version: 1.11.0
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 1.9.1
26
+ version: 1.11.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: cucumber
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -39,7 +39,7 @@ dependencies:
39
39
  - !ruby/object:Gem::Version
40
40
  version: '1.3'
41
41
  - !ruby/object:Gem::Dependency
42
- name: mysql2
42
+ name: sqlite3
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - ">="
@@ -81,7 +81,21 @@ dependencies:
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
- name: complex_config
84
+ name: database_cleaner
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '1.3'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '1.3'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rubocop
85
99
  requirement: !ruby/object:Gem::Requirement
86
100
  requirements:
87
101
  - - ">="
@@ -100,20 +114,20 @@ dependencies:
100
114
  requirements:
101
115
  - - ">="
102
116
  - !ruby/object:Gem::Version
103
- version: '4.1'
117
+ version: '5.1'
104
118
  - - "<"
105
119
  - !ruby/object:Gem::Version
106
- version: '6'
120
+ version: '8'
107
121
  type: :runtime
108
122
  prerelease: false
109
123
  version_requirements: !ruby/object:Gem::Requirement
110
124
  requirements:
111
125
  - - ">="
112
126
  - !ruby/object:Gem::Version
113
- version: '4.1'
127
+ version: '5.1'
114
128
  - - "<"
115
129
  - !ruby/object:Gem::Version
116
- version: '6'
130
+ version: '8'
117
131
  - !ruby/object:Gem::Dependency
118
132
  name: actionpack
119
133
  requirement: !ruby/object:Gem::Requirement
@@ -123,7 +137,7 @@ dependencies:
123
137
  version: '4.1'
124
138
  - - "<"
125
139
  - !ruby/object:Gem::Version
126
- version: '6'
140
+ version: '8'
127
141
  type: :runtime
128
142
  prerelease: false
129
143
  version_requirements: !ruby/object:Gem::Requirement
@@ -133,21 +147,7 @@ dependencies:
133
147
  version: '4.1'
134
148
  - - "<"
135
149
  - !ruby/object:Gem::Version
136
- version: '6'
137
- - !ruby/object:Gem::Dependency
138
- name: database_cleaner
139
- requirement: !ruby/object:Gem::Requirement
140
- requirements:
141
- - - "~>"
142
- - !ruby/object:Gem::Version
143
- version: '1.3'
144
- type: :runtime
145
- prerelease: false
146
- version_requirements: !ruby/object:Gem::Requirement
147
- requirements:
148
- - - "~>"
149
- - !ruby/object:Gem::Version
150
- version: '1.3'
150
+ version: '8'
151
151
  description: acts_as_account implements double entry accounting for Rails models.
152
152
  Your models get accounts and you can do consistent transactions between them. Since
153
153
  the documentation is sparse, see the transfer.feature for usage examples.
@@ -155,7 +155,7 @@ email: developers@betterplace.org
155
155
  executables: []
156
156
  extensions: []
157
157
  extra_rdoc_files:
158
- - README.rdoc
158
+ - README.md
159
159
  - lib/acts_as_account.rb
160
160
  - lib/acts_as_account/account.rb
161
161
  - lib/acts_as_account/active_record_extensions.rb
@@ -167,15 +167,18 @@ extra_rdoc_files:
167
167
  - lib/acts_as_account/transfer.rb
168
168
  - lib/acts_as_account/version.rb
169
169
  files:
170
+ - ".github/workflows/lint.yml"
171
+ - ".github/workflows/tests.yml"
170
172
  - ".gitignore"
171
- - ".travis.yml"
173
+ - ".rubocop.yml"
172
174
  - CHANGELOG.md
173
175
  - Gemfile
174
176
  - LICENSE
175
- - README.rdoc
177
+ - README.md
176
178
  - Rakefile
177
179
  - VERSION
178
180
  - acts_as_account.gemspec
181
+ - acts_as_account.sqlite
179
182
  - cucumber.yml
180
183
  - features/account/account_creation.feature
181
184
  - features/db/database.yml
@@ -199,16 +202,16 @@ files:
199
202
  - lib/acts_as_account/rails.rb
200
203
  - lib/acts_as_account/transfer.rb
201
204
  - lib/acts_as_account/version.rb
202
- homepage: http://github.com/betterplace/acts_as_account
205
+ homepage: https://github.com/betterplace/acts_as_account
203
206
  licenses:
204
207
  - Apache-2.0
205
208
  metadata: {}
206
- post_install_message:
209
+ post_install_message:
207
210
  rdoc_options:
208
211
  - "--title"
209
212
  - ActsAsAccount -- More Math in Ruby
210
213
  - "--main"
211
- - README.rdoc
214
+ - README.md
212
215
  require_paths:
213
216
  - lib
214
217
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -222,9 +225,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
222
225
  - !ruby/object:Gem::Version
223
226
  version: '0'
224
227
  requirements: []
225
- rubyforge_project:
226
- rubygems_version: 2.6.8
227
- signing_key:
228
+ rubygems_version: 3.3.3
229
+ signing_key:
228
230
  specification_version: 4
229
231
  summary: acts_as_account implements double entry accounting for Rails models
230
232
  test_files: []
data/.travis.yml DELETED
@@ -1,4 +0,0 @@
1
- rvm:
2
- - 2.3.3
3
- sudo: false
4
- script: rake
data/README.rdoc DELETED
@@ -1,42 +0,0 @@
1
- = acts_as_account
2
-
3
- {<img src="https://travis-ci.org/betterplace/acts_as_account.svg?branch=master" alt="Build Status" />}[https://travis-ci.org/betterplace/acts_as_account]
4
-
5
- == Theory
6
-
7
- ActsAsAccount implements a "Double Entry Accounting" system for your
8
- Rails-models.
9
-
10
- It hooks into ActiveRecord and allows to add accounts to any model by
11
- simply means of adding "has_account" to your model. Because the accounts
12
- are connected via a has_many relation no migration to the account-holder
13
- tables is needed.
14
-
15
- We also hook into the ActionController request cycle to warn the developer
16
- if a request has left the uncommitted changes in the system.
17
-
18
- == Support
19
-
20
- Rails 4 is supported since version 3.1.0
21
-
22
- == How to test
23
-
24
- Run the cucumber features from the acs_as_account gem, just execute
25
- * rake features:create_database
26
- * cucumber
27
-
28
- == Links
29
-
30
- * Double Entry Accounting in a Relational Database: http://homepages.tcp.co.uk/~m-wigley/gc_wp_ded.html
31
-
32
- == Compatibility
33
-
34
- With the release of version 2.0.0 acts_as_account is supposed to work for Rails 3. If you still use Rails 2 please use version 1.2.0.
35
-
36
- == Credits
37
-
38
- This gem was written for the payment backend of betterplace.org by Thies C. Arntzen (http://github.com/thieso2) and Norman Timmler (github.com/unnu).
39
-
40
- == Copyright
41
-
42
- Copyright (c) 2010 gut.org gAG