paper_trail_scrapbook 0.1.21 → 0.2.0

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
2
  SHA256:
3
- metadata.gz: c3ea6a987eb4b121ef35faa696cbab0e1280f82c9c5c50994cedbcfa3fd2a161
4
- data.tar.gz: 750cd326b91c05264c536476836cc64f612ef8e82e043be3f4cdd9fe5139a493
3
+ metadata.gz: 1ab2da369e6db07c4fdf12e63335ffd33e269beee77b903d6d12db40d8c0755f
4
+ data.tar.gz: fc86adc663d1695905ef6500554962f2cdf7e5127b644f43e82afd00e529e05a
5
5
  SHA512:
6
- metadata.gz: 34b3c0af6ab002f7e4c076d6f490a6e9546e8c4b91b5c27e9679b6e669a072a00159a8cfebaf47b56601c714a26959f9692bd0baa75a92a039ff46a2584d9345
7
- data.tar.gz: 84652d9b2f8fbf4c5a2d234fb6db4cea7dd4b50f8321aacd049caed5db0a2f968107b5dc328ed3bac855235f9902a81b83becd9357af3cf973da399d6990a606
6
+ metadata.gz: '08828b154f081625bce0fe40bac7dcc6f60df04098671e04798fc271bd68eed7f7f1e613c090ce7589e78089de16c4defa841d5c534e18fced196fe55c720d35'
7
+ data.tar.gz: fd9d86505bc9375e67576e8bc8aae247d824e8bf1ab3cd029aca34f5d15f92f42435ad20e48be32bed56dbd4df500b3c5758f20cb56082be0b6a222adc662aa9
@@ -0,0 +1,62 @@
1
+ # This workflow uses actions that are not certified by GitHub. They are
2
+ # provided by a third-party and are governed by separate terms of service,
3
+ # privacy policy, and support documentation.
4
+ #
5
+ # This workflow will install a prebuilt Ruby version, install dependencies, and
6
+ # run tests and linters.
7
+ name: "CI"
8
+ on:
9
+ push:
10
+ branches: [ "master" ]
11
+ pull_request:
12
+ branches: [ "master" ]
13
+ jobs:
14
+ test:
15
+ runs-on: ubuntu-latest
16
+ services:
17
+ postgres:
18
+ image: postgres
19
+ ports:
20
+ - "5432:5432"
21
+ env:
22
+ POSTGRES_DB: pts_db
23
+ POSTGRES_USER: postgres
24
+ POSTGRES_PASSWORD: postgres
25
+
26
+ # needed because the postgres container does not provide a healthcheck
27
+ options: >-
28
+ --health-cmd pg_isready
29
+ --health-interval 10s
30
+ --health-timeout 5s
31
+ --health-retries 5
32
+ env:
33
+ RAILS_ENV: test
34
+ DATABASE_NAME: pts_db
35
+ DATABASE_USER: postgres
36
+ DATABASE_PASSWORD: postgres
37
+ DATABASE_HOST: "127.0.0.1"
38
+
39
+ steps:
40
+ - name: Checkout code
41
+ uses: actions/checkout@v3
42
+ - name: Install Ruby and gems
43
+ uses: ruby/setup-ruby@v1
44
+ with:
45
+ bundler-cache: true
46
+ - name: Set up database
47
+ run: bundle exec rake prepare
48
+ # Add or replace test runners here
49
+ - name: Run tests
50
+ run: bundle exec rspec
51
+
52
+ lint:
53
+ runs-on: ubuntu-latest
54
+ steps:
55
+ - name: Checkout code
56
+ uses: actions/checkout@v3
57
+ - name: Install Ruby and gems
58
+ uses: ruby/setup-ruby@v1
59
+ with:
60
+ bundler-cache: true
61
+ - name: Lint Ruby files
62
+ run: bundle exec rubocop
data/.gitignore CHANGED
@@ -1 +1,4 @@
1
1
  test.log
2
+ .tool*
3
+
4
+ coverage*
data/.rubocop.yml CHANGED
@@ -1,7 +1,7 @@
1
1
  AllCops:
2
2
  DisabledByDefault: false
3
- TargetRubyVersion: 2.3
4
- TargetRailsVersion: 4.0
3
+ TargetRubyVersion: 2.6
4
+ TargetRailsVersion: 6.1
5
5
  DisplayCopNames: true
6
6
  Exclude:
7
7
  - 'db/**/*'
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.3.7
1
+ 2.6.7
data/Gemfile.lock CHANGED
@@ -1,198 +1,165 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- paper_trail_scrapbook (0.1.21)
4
+ paper_trail_scrapbook (0.2.0)
5
5
  activerecord
6
6
  adamantium
7
7
  concord
8
- paper_trail (>= 5.2, <= 11.1.0)
8
+ paper_trail (>= 11, < 13)
9
9
 
10
10
  GEM
11
11
  remote: https://rubygems.org/
12
12
  specs:
13
- abstract_type (0.0.7)
14
- actionpack (5.2.3)
15
- actionview (= 5.2.3)
16
- activesupport (= 5.2.3)
17
- rack (~> 2.0)
13
+ actionpack (6.1.6.1)
14
+ actionview (= 6.1.6.1)
15
+ activesupport (= 6.1.6.1)
16
+ rack (~> 2.0, >= 2.0.9)
18
17
  rack-test (>= 0.6.3)
19
18
  rails-dom-testing (~> 2.0)
20
- rails-html-sanitizer (~> 1.0, >= 1.0.2)
21
- actionview (5.2.3)
22
- activesupport (= 5.2.3)
19
+ rails-html-sanitizer (~> 1.0, >= 1.2.0)
20
+ actionview (6.1.6.1)
21
+ activesupport (= 6.1.6.1)
23
22
  builder (~> 3.1)
24
23
  erubi (~> 1.4)
25
24
  rails-dom-testing (~> 2.0)
26
- rails-html-sanitizer (~> 1.0, >= 1.0.3)
27
- activemodel (5.2.3)
28
- activesupport (= 5.2.3)
29
- activerecord (5.2.3)
30
- activemodel (= 5.2.3)
31
- activesupport (= 5.2.3)
32
- arel (>= 9.0)
33
- activesupport (5.2.3)
25
+ rails-html-sanitizer (~> 1.1, >= 1.2.0)
26
+ activemodel (6.1.6.1)
27
+ activesupport (= 6.1.6.1)
28
+ activerecord (6.1.6.1)
29
+ activemodel (= 6.1.6.1)
30
+ activesupport (= 6.1.6.1)
31
+ activesupport (6.1.6.1)
34
32
  concurrent-ruby (~> 1.0, >= 1.0.2)
35
- i18n (>= 0.7, < 2)
36
- minitest (~> 5.1)
37
- tzinfo (~> 1.1)
33
+ i18n (>= 1.6, < 2)
34
+ minitest (>= 5.1)
35
+ tzinfo (~> 2.0)
36
+ zeitwerk (~> 2.3)
38
37
  adamantium (0.2.0)
39
38
  ice_nine (~> 0.11.0)
40
39
  memoizable (~> 0.4.0)
41
- anima (0.3.0)
42
- abstract_type (~> 0.0.7)
43
- adamantium (~> 0.2)
44
- equalizer (~> 0.0.11)
45
- arel (9.0.0)
46
- ast (2.3.0)
47
- builder (3.2.3)
48
- codeclimate-test-reporter (1.0.8)
40
+ ast (2.4.2)
41
+ builder (3.2.4)
42
+ codeclimate-test-reporter (1.0.9)
49
43
  simplecov (<= 0.13)
50
- concord (0.1.5)
44
+ concord (0.1.6)
51
45
  adamantium (~> 0.2.0)
52
46
  equalizer (~> 0.0.9)
53
- concurrent-ruby (1.1.5)
54
- crass (1.0.5)
55
- database_cleaner (1.6.2)
56
- diff-lcs (1.3)
47
+ concurrent-ruby (1.1.10)
48
+ crass (1.0.6)
49
+ database_cleaner (2.0.1)
50
+ database_cleaner-active_record (~> 2.0.0)
51
+ database_cleaner-active_record (2.0.1)
52
+ activerecord (>= 5.a)
53
+ database_cleaner-core (~> 2.0.0)
54
+ database_cleaner-core (2.0.1)
55
+ diff-lcs (1.5.0)
57
56
  docile (1.1.5)
58
57
  equalizer (0.0.11)
59
- erubi (1.9.0)
60
- ffaker (2.8.1)
61
- i18n (1.7.0)
58
+ erubi (1.11.0)
59
+ ffaker (2.21.0)
60
+ i18n (1.12.0)
62
61
  concurrent-ruby (~> 1.0)
63
62
  ice_nine (0.11.2)
64
- json (2.3.1)
65
- loofah (2.3.1)
63
+ json (2.6.2)
64
+ loofah (2.18.0)
66
65
  crass (~> 1.0.2)
67
66
  nokogiri (>= 1.5.9)
68
67
  memoizable (0.4.2)
69
68
  thread_safe (~> 0.3, >= 0.3.1)
70
- method_source (0.9.2)
71
- mini_portile2 (2.4.0)
72
- minitest (5.12.2)
73
- morpher (0.2.6)
74
- abstract_type (~> 0.0.7)
75
- adamantium (~> 0.2.0)
76
- anima (~> 0.3.0)
77
- ast (~> 2.2)
78
- concord (~> 0.1.5)
79
- equalizer (~> 0.0.9)
80
- ice_nine (~> 0.11.0)
81
- procto (~> 0.0.2)
82
- mutant (0.8.14)
83
- abstract_type (~> 0.0.7)
84
- adamantium (~> 0.2.0)
85
- anima (~> 0.3.0)
86
- ast (~> 2.2)
87
- concord (~> 0.1.5)
88
- diff-lcs (~> 1.3)
89
- equalizer (~> 0.0.9)
90
- ice_nine (~> 0.11.1)
91
- memoizable (~> 0.4.2)
92
- morpher (~> 0.2.6)
93
- parallel (~> 1.3)
94
- parser (>= 2.3.1.4, < 2.5)
95
- procto (~> 0.0.2)
96
- regexp_parser (~> 0.4.3)
97
- unparser (~> 0.2.5)
98
- mutant-rspec (0.8.14)
99
- mutant (~> 0.8.14)
100
- rspec-core (>= 3.4.0, < 3.7.0)
101
- nokogiri (1.10.8)
102
- mini_portile2 (~> 2.4.0)
103
- paper_trail (10.3.1)
104
- activerecord (>= 4.2)
69
+ method_source (1.0.0)
70
+ mini_portile2 (2.8.0)
71
+ minitest (5.16.2)
72
+ nokogiri (1.13.8)
73
+ mini_portile2 (~> 2.8.0)
74
+ racc (~> 1.4)
75
+ paper_trail (12.3.0)
76
+ activerecord (>= 5.2)
105
77
  request_store (~> 1.1)
106
- parallel (1.12.1)
107
- parser (2.4.0.2)
108
- ast (~> 2.3)
109
- pg (1.2.3)
110
- powerpack (0.1.1)
111
- procto (0.0.3)
112
- rack (2.2.3)
113
- rack-test (1.1.0)
114
- rack (>= 1.0, < 3)
78
+ parallel (1.22.1)
79
+ parser (3.1.2.1)
80
+ ast (~> 2.4.1)
81
+ pg (1.4.3)
82
+ racc (1.6.0)
83
+ rack (2.2.4)
84
+ rack-test (2.0.2)
85
+ rack (>= 1.3)
115
86
  rails-dom-testing (2.0.3)
116
87
  activesupport (>= 4.2.0)
117
88
  nokogiri (>= 1.6)
118
- rails-html-sanitizer (1.2.0)
119
- loofah (~> 2.2, >= 2.2.2)
120
- railties (5.2.3)
121
- actionpack (= 5.2.3)
122
- activesupport (= 5.2.3)
89
+ rails-html-sanitizer (1.4.3)
90
+ loofah (~> 2.3)
91
+ railties (6.1.6.1)
92
+ actionpack (= 6.1.6.1)
93
+ activesupport (= 6.1.6.1)
123
94
  method_source
124
- rake (>= 0.8.7)
125
- thor (>= 0.19.0, < 2.0)
126
- rainbow (3.0.0)
127
- rake (13.0.1)
128
- regexp_parser (0.4.9)
129
- request_store (1.5.0)
95
+ rake (>= 12.2)
96
+ thor (~> 1.0)
97
+ rainbow (3.1.1)
98
+ rake (13.0.6)
99
+ regexp_parser (2.5.0)
100
+ request_store (1.5.1)
130
101
  rack (>= 1.4)
131
- rspec-core (3.6.0)
132
- rspec-support (~> 3.6.0)
133
- rspec-expectations (3.6.0)
102
+ rexml (3.2.5)
103
+ rspec-core (3.11.0)
104
+ rspec-support (~> 3.11.0)
105
+ rspec-expectations (3.11.0)
134
106
  diff-lcs (>= 1.2.0, < 2.0)
135
- rspec-support (~> 3.6.0)
136
- rspec-jumpstart (1.1.2)
137
- rspec-mocks (3.6.0)
107
+ rspec-support (~> 3.11.0)
108
+ rspec-jumpstart (1.1.5)
109
+ rspec-mocks (3.11.1)
138
110
  diff-lcs (>= 1.2.0, < 2.0)
139
- rspec-support (~> 3.6.0)
140
- rspec-rails (3.6.1)
141
- actionpack (>= 3.0)
142
- activesupport (>= 3.0)
143
- railties (>= 3.0)
144
- rspec-core (~> 3.6.0)
145
- rspec-expectations (~> 3.6.0)
146
- rspec-mocks (~> 3.6.0)
147
- rspec-support (~> 3.6.0)
148
- rspec-support (3.6.0)
149
- rspec_junit_formatter (0.4.1)
111
+ rspec-support (~> 3.11.0)
112
+ rspec-rails (5.1.2)
113
+ actionpack (>= 5.2)
114
+ activesupport (>= 5.2)
115
+ railties (>= 5.2)
116
+ rspec-core (~> 3.10)
117
+ rspec-expectations (~> 3.10)
118
+ rspec-mocks (~> 3.10)
119
+ rspec-support (~> 3.10)
120
+ rspec-support (3.11.0)
121
+ rspec_junit_formatter (0.5.1)
150
122
  rspec-core (>= 2, < 4, != 2.12.0)
151
- rubocop (0.52.1)
123
+ rubocop (1.35.0)
124
+ json (~> 2.3)
152
125
  parallel (~> 1.10)
153
- parser (>= 2.4.0.2, < 3.0)
154
- powerpack (~> 0.1)
126
+ parser (>= 3.1.2.1)
155
127
  rainbow (>= 2.2.2, < 4.0)
128
+ regexp_parser (>= 1.8, < 3.0)
129
+ rexml (>= 3.2.5, < 4.0)
130
+ rubocop-ast (>= 1.20.1, < 2.0)
156
131
  ruby-progressbar (~> 1.7)
157
- unicode-display_width (~> 1.0, >= 1.0.1)
158
- rubocop-rspec (1.22.1)
159
- rubocop (>= 0.52.1)
160
- ruby-progressbar (1.9.0)
132
+ unicode-display_width (>= 1.4.0, < 3.0)
133
+ rubocop-ast (1.21.0)
134
+ parser (>= 3.1.1.0)
135
+ rubocop-rspec (2.12.1)
136
+ rubocop (~> 1.31)
137
+ ruby-progressbar (1.11.0)
161
138
  simplecov (0.13.0)
162
139
  docile (~> 1.1.0)
163
140
  json (>= 1.8, < 3)
164
141
  simplecov-html (~> 0.10.0)
165
142
  simplecov-html (0.10.2)
166
- thor (0.20.3)
143
+ thor (1.2.1)
167
144
  thread_safe (0.3.6)
168
145
  timecop (0.8.1)
169
- tzinfo (1.2.5)
170
- thread_safe (~> 0.1)
171
- unicode-display_width (1.3.0)
172
- unparser (0.2.6)
173
- abstract_type (~> 0.0.7)
174
- adamantium (~> 0.2.0)
175
- concord (~> 0.1.5)
176
- diff-lcs (~> 1.3)
177
- equalizer (~> 0.0.9)
178
- parser (>= 2.3.1.2, < 2.5)
179
- procto (~> 0.0.2)
146
+ tzinfo (2.0.5)
147
+ concurrent-ruby (~> 1.0)
148
+ unicode-display_width (2.2.0)
149
+ zeitwerk (2.6.0)
180
150
 
181
151
  PLATFORMS
182
152
  ruby
183
- x86_64-darwin-20
184
153
 
185
154
  DEPENDENCIES
186
155
  codeclimate-test-reporter (~> 1.0.7)
187
- database_cleaner (~> 1.2)
156
+ database_cleaner
188
157
  ffaker (~> 2.5)
189
- loofah (~> 2.3.1)
190
- mutant
191
- mutant-rspec
158
+ loofah
192
159
  paper_trail_scrapbook!
193
- pg (= 1.2.3)
160
+ pg
194
161
  rack (>= 2.0.6)
195
- railties (= 5.2.3)
162
+ railties (>= 5.2.3)
196
163
  rake (~> 13.0.1)
197
164
  rspec-jumpstart
198
165
  rspec-rails
@@ -203,4 +170,4 @@ DEPENDENCIES
203
170
  timecop (~> 0.8.0)
204
171
 
205
172
  BUNDLED WITH
206
- 2.2.2
173
+ 2.2.26
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Paper Trail Scrapbook
2
2
 
3
- [![CircleCI](https://circleci.com/gh/hintmedia/paper_trail_scrapbook/tree/master.svg?style=svg)](https://circleci.com/gh/tjchambers/paper_trail_scrapbook/tree/master)
3
+
4
4
  [![Gem Version](https://badge.fury.io/rb/paper_trail_scrapbook.svg)](https://badge.fury.io/rb/paper_trail_scrapbook)
5
5
 
6
6
  Human Readable audit reporting for users of [PaperTrail](https://github.com/paper-trail-gem/paper_trail) gem.
@@ -30,9 +30,9 @@ module PaperTrailScrapbook
30
30
  def change_log
31
31
  text =
32
32
  changes
33
- .map { |k, v| digest(k, v) }
34
- .compact
35
- .join("\n")
33
+ .map { |k, v| digest(k, v) }
34
+ .compact
35
+ .join("\n")
36
36
 
37
37
  text = text.gsub(' id:', ':') if PaperTrailScrapbook.config.drop_id_suffix
38
38
  text
@@ -40,8 +40,8 @@ module PaperTrailScrapbook
40
40
 
41
41
  private
42
42
 
43
- def polymorphic?(x)
44
- x.to_s.start_with?(POLYMORPH_BT_INDICATOR)
43
+ def polymorphic?(key)
44
+ key.to_s.start_with?(POLYMORPH_BT_INDICATOR)
45
45
  end
46
46
 
47
47
  def digest(key, values)
@@ -82,7 +82,8 @@ module PaperTrailScrapbook
82
82
  def assoc_target(key)
83
83
  x = build_associations[key]
84
84
  return x unless polymorphic?(x)
85
- ref = x[1..-1] + '_type'
85
+
86
+ ref = "#{x[1..]}_type"
86
87
 
87
88
  # try object changes to see if the belongs_to class is specified
88
89
  latest_class = changes[ref]&.last
@@ -90,16 +91,19 @@ module PaperTrailScrapbook
90
91
  if latest_class.nil? && create?
91
92
  # try the db default class
92
93
  # for creates where the object changes do not specify this it
93
- # is most likely because the default == type selected so
94
+ # is most likely because the default == type selected so
94
95
  # the default was not changed and therefore is not in
95
96
  # object changes
96
- orig_instance = Object.const_get(version.item_type.classify).new
97
- latest_class = orig_instance[ref.to_sym]
97
+ latest_class = orig_instance[ref.to_sym]
98
98
  end
99
99
 
100
100
  Object.const_get(latest_class.classify)
101
101
  end
102
102
 
103
+ def orig_instance
104
+ Object.const_get(version.item_type.classify).new
105
+ end
106
+
103
107
  def assoc_klass(name, options = {})
104
108
  direct_class = options[:class_name]
105
109
  poly = options[:polymorphic]
@@ -119,9 +123,9 @@ module PaperTrailScrapbook
119
123
  @build_associations ||=
120
124
  Hash[
121
125
  klass
122
- .reflect_on_all_associations
123
- .select { |a| a.macro.equal?(:belongs_to) }
124
- .map { |x| [x.foreign_key.to_s, assoc_klass(x.name, x.options)] }
126
+ .reflect_on_all_associations
127
+ .select { |a| a.macro.equal?(:belongs_to) }
128
+ .map { |x| [x.foreign_key.to_s, assoc_klass(x.name, x.options)] }
125
129
  ]
126
130
  end
127
131
 
@@ -8,8 +8,8 @@ module PaperTrailScrapbook
8
8
  include Singleton
9
9
 
10
10
  DEFAULT_TIME_FORMAT = '%A, %d %b %Y at %l:%M %p'
11
- DEFAULT_EVENTS = { 'create' => 'created',
12
- 'update' => 'updated',
11
+ DEFAULT_EVENTS = { 'create' => 'created',
12
+ 'update' => 'updated',
13
13
  'destroy' => 'destroyed' }.freeze
14
14
 
15
15
  SCRUB_COLUMNS = %w[updated_at created_at id].freeze
@@ -46,7 +46,7 @@ module PaperTrailScrapbook
46
46
  params = { whodunnit: user_id }
47
47
  return params if options.empty?
48
48
 
49
- params.merge(item_type: what,
49
+ params.merge(item_type: what,
50
50
  created_at: starts..ends)
51
51
  .delete_if { |_, v| v.presence.nil? }
52
52
  end
@@ -2,5 +2,5 @@
2
2
 
3
3
  module PaperTrailScrapbook
4
4
  # Current version
5
- VERSION = '0.1.21'
5
+ VERSION = '0.2.0'
6
6
  end
@@ -53,10 +53,10 @@ module PaperTrailScrapbook
53
53
 
54
54
  def whodunnit_instance(author)
55
55
  instance = begin
56
- whodunnit_class.find(author)
57
- rescue StandardError
58
- config.invalid_whodunnit.call(author)
59
- end
56
+ whodunnit_class.find(author)
57
+ rescue StandardError
58
+ config.invalid_whodunnit.call(author)
59
+ end
60
60
 
61
61
  return instance.to_whodunnit if instance.respond_to?(:to_whodunnit)
62
62
 
@@ -1,6 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PaperTrailScrapbook
4
+ # Fetches available versions and related version info
5
+ # Provides filtering
4
6
  class Versions
5
7
  include Concord.new(:object)
6
8
 
@@ -9,21 +11,15 @@ module PaperTrailScrapbook
9
11
  end
10
12
 
11
13
  def related_content
12
- unless object.respond_to?(:trailed_related_content)
13
- return []
14
- end
14
+ return [] unless object.respond_to?(:trailed_related_content)
15
15
 
16
16
  object.trailed_related_content.compact.flat_map(&:versions)
17
17
  end
18
18
 
19
19
  def filtered(object_versions)
20
- unless object.respond_to?(:version_filter)
21
- return object_versions
22
- end
20
+ return object_versions unless object.respond_to?(:version_filter)
23
21
 
24
22
  object_versions.select { |v| object.version_filter(v) }
25
23
  end
26
-
27
24
  end
28
-
29
25
  end
@@ -15,32 +15,30 @@ Gem::Specification.new do |gem|
15
15
  gem.license = 'MIT'
16
16
 
17
17
  gem.required_rubygems_version = '>= 1.3.6'
18
- gem.required_ruby_version = '>= 2.3.0'
18
+ gem.required_ruby_version = '>= 2.6'
19
19
 
20
20
  # Rails does not follow semver, makes breaking changes in minor versions.
21
21
  gem.add_dependency 'activerecord'
22
22
  gem.add_dependency 'adamantium'
23
23
  gem.add_dependency 'concord'
24
- gem.add_dependency 'paper_trail', ['>= 5.2', '<= 11.1.0']
24
+ gem.add_dependency 'paper_trail', ['>= 11', '< 13']
25
25
 
26
26
  gem.add_development_dependency 'ffaker', '~> 2.5'
27
27
  gem.add_development_dependency 'rake', '~> 13.0.1'
28
28
 
29
29
  # Why `railties`? Possibly used by `spec/dummy_app` boot up?
30
- gem.add_development_dependency 'railties', '= 5.2.3'
30
+ gem.add_development_dependency 'railties', '>= 5.2.3'
31
31
 
32
32
  gem.add_development_dependency 'codeclimate-test-reporter', '~> 1.0.7'
33
- gem.add_development_dependency 'database_cleaner', '~> 1.2'
34
- gem.add_development_dependency 'loofah', '~> 2.3.1'
35
- gem.add_development_dependency 'mutant'
36
- gem.add_development_dependency 'mutant-rspec'
37
- gem.add_development_dependency 'pg', '= 1.2.3'
38
- gem.add_development_dependency 'rspec-rails'
33
+ gem.add_development_dependency 'database_cleaner'
34
+ gem.add_development_dependency 'loofah'
35
+ gem.add_development_dependency 'pg'
36
+ gem.add_development_dependency 'rack', '>= 2.0.6'
39
37
  gem.add_development_dependency 'rspec-jumpstart'
40
38
  gem.add_development_dependency 'rspec_junit_formatter'
39
+ gem.add_development_dependency 'rspec-rails'
41
40
  gem.add_development_dependency 'rubocop'
42
41
  gem.add_development_dependency 'rubocop-rspec'
43
42
  gem.add_development_dependency 'simplecov'
44
43
  gem.add_development_dependency 'timecop', '~> 0.8.0'
45
- gem.add_development_dependency 'rack', '>= 2.0.6'
46
44
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  class Document < ActiveRecord::Base
4
4
  has_paper_trail(
5
- versions: {name: :paper_trail_versions},
5
+ versions: { name: :paper_trail_versions },
6
6
  on: %i[create update]
7
7
  )
8
8
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class Fruit < ActiveRecord::Base
4
- has_paper_trail class_name: 'JsonVersion' if ENV['DB'] == 'postgres' || JsonVersion.table_exists?
4
+ has_paper_trail versions: { class_name: 'JsonVersion' } if ENV['DATABASE_HOST'] == 'postgres' || JsonVersion.table_exists?
5
5
  end
@@ -34,6 +34,7 @@ class Song < ActiveRecord::Base
34
34
  attribute :name, :string
35
35
  else
36
36
  attr_accessor :name
37
+
37
38
  prepend OverrideSongAttributesTheRails4Way
38
39
  end
39
40
  end
@@ -2,8 +2,10 @@
2
2
  test: &test
3
3
  adapter: postgresql
4
4
  encoding: unicode
5
- host: localhost
5
+ host: <%= ENV['DATABASE_HOST'] || 'localhost' %>
6
6
  database: pts_db
7
+ username: postgres
8
+ password: postgres
7
9
  port: <%= ENV['DB_PORT'] || 5432 %>
8
10
  pool: 5
9
11
 
@@ -2,5 +2,5 @@
2
2
 
3
3
  # This file is used by Rack-based servers to start the application.
4
4
 
5
- require ::File.expand_path('../config/environment', __FILE__)
5
+ require ::File.expand_path('config/environment', __dir__)
6
6
  run Dummy::Application