paper_trail_scrapbook 0.1.15 → 0.1.20

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: 3cd11a4eeaf7c668fe41fe854748cf0f2e8fcaed
4
- data.tar.gz: a1143aad24dcaa956b19fd47142e7e52b52bc8c4
2
+ SHA256:
3
+ metadata.gz: d28081ea53e66d2b3bb58193dfb7c7022bb2cb0ac0d95bd9b15e244bff4513c5
4
+ data.tar.gz: 9d571ffcc8e57397c3a796eb4c2d4c24588247908bb90819b901f283cd81bd17
5
5
  SHA512:
6
- metadata.gz: 7d8ef81dbaa77a0a90944adc34086ef4482fa6a97304490f4f929520465e7b56398868beb04f0ad433742b2d94fed78d019b63a36603ccd62d08ecba4b022c6a
7
- data.tar.gz: ff4accb4de852aaacff14195e42b520ee4eac4f3a95370d8e43d24e1aa7492c3afd752af0e68524757438a14cb5383c1f8f256713bfb20c9d51ab8cc6a5962e4
6
+ metadata.gz: 376af1531b2da2a540a80629c18c499c942e37290548442dace684b631a3a32506f84fea3e891fdcc2f51c1ef7fbc3fe1080d72e548b8ea1338dd9a305189a21
7
+ data.tar.gz: 869c43e8449e20be7a3cc7b4bbf1037a45ada754819a2d029052e264c953c63ff53e04bb616f104e3563c03881c0231bbcf948d2958e63cd5447dd9c25f8676f
@@ -1,6 +1,8 @@
1
1
  defaults: &defaults
2
2
  docker:
3
3
  - image: circleci/ruby:2.5.0-node-browsers
4
+ environment:
5
+ PGUSER: circleci
4
6
  - image: circleci/postgres:9.5-alpine
5
7
  environment:
6
8
  POSTGRES_USER: circleci
@@ -21,10 +23,11 @@ jobs:
21
23
  command: |
22
24
  echo 'export BUNDLER_VERSION=$(cat Gemfile.lock | tail -1 | tr -d " ")' >> $BASH_ENV
23
25
  source $BASH_ENV
24
- gem install bundler
26
+ gem install bundler -v $BUNDLER_VERSION
25
27
  - run:
26
28
  name: Bundle Install
27
- command: bundle check || bundle install
29
+ command:
30
+ bundle check || bundle install
28
31
  - save_cache:
29
32
  key: paper_trail_scrapbook-{{ checksum "Gemfile.lock" }}
30
33
  paths:
@@ -5,6 +5,12 @@ recommendations of [keepachangelog.com](http://keepachangelog.com/).
5
5
 
6
6
  ## Unreleased
7
7
 
8
+ ## 0.1.20 (2020-12-24) Bugfix Release
9
+
10
+ ### Fixed
11
+
12
+ - Missing require for new Versions
13
+
8
14
  ## 0.1.11 (2018-08-09) Functional Release
9
15
 
10
16
  ### Breaking Changes
@@ -77,4 +83,3 @@ recommendations of [keepachangelog.com](http://keepachangelog.com/).
77
83
  ### Fixed
78
84
 
79
85
  - None
80
-
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- paper_trail_scrapbook (0.1.15)
4
+ paper_trail_scrapbook (0.1.19)
5
5
  activerecord
6
6
  adamantium
7
7
  concord
@@ -11,26 +11,26 @@ GEM
11
11
  remote: https://rubygems.org/
12
12
  specs:
13
13
  abstract_type (0.0.7)
14
- actionpack (5.2.2.1)
15
- actionview (= 5.2.2.1)
16
- activesupport (= 5.2.2.1)
14
+ actionpack (5.2.3)
15
+ actionview (= 5.2.3)
16
+ activesupport (= 5.2.3)
17
17
  rack (~> 2.0)
18
18
  rack-test (>= 0.6.3)
19
19
  rails-dom-testing (~> 2.0)
20
20
  rails-html-sanitizer (~> 1.0, >= 1.0.2)
21
- actionview (5.2.2.1)
22
- activesupport (= 5.2.2.1)
21
+ actionview (5.2.3)
22
+ activesupport (= 5.2.3)
23
23
  builder (~> 3.1)
24
24
  erubi (~> 1.4)
25
25
  rails-dom-testing (~> 2.0)
26
26
  rails-html-sanitizer (~> 1.0, >= 1.0.3)
27
- activemodel (5.2.2.1)
28
- activesupport (= 5.2.2.1)
29
- activerecord (5.2.2.1)
30
- activemodel (= 5.2.2.1)
31
- activesupport (= 5.2.2.1)
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
32
  arel (>= 9.0)
33
- activesupport (5.2.2.1)
33
+ activesupport (5.2.3)
34
34
  concurrent-ruby (~> 1.0, >= 1.0.2)
35
35
  i18n (>= 0.7, < 2)
36
36
  minitest (~> 5.1)
@@ -51,25 +51,25 @@ GEM
51
51
  adamantium (~> 0.2.0)
52
52
  equalizer (~> 0.0.9)
53
53
  concurrent-ruby (1.1.5)
54
- crass (1.0.4)
54
+ crass (1.0.5)
55
55
  database_cleaner (1.6.2)
56
56
  diff-lcs (1.3)
57
57
  docile (1.1.5)
58
58
  equalizer (0.0.11)
59
- erubi (1.8.0)
59
+ erubi (1.9.0)
60
60
  ffaker (2.8.1)
61
- i18n (1.6.0)
61
+ i18n (1.7.0)
62
62
  concurrent-ruby (~> 1.0)
63
63
  ice_nine (0.11.2)
64
- json (2.1.0)
65
- loofah (2.2.3)
64
+ json (2.3.1)
65
+ loofah (2.3.1)
66
66
  crass (~> 1.0.2)
67
67
  nokogiri (>= 1.5.9)
68
68
  memoizable (0.4.2)
69
69
  thread_safe (~> 0.3, >= 0.3.1)
70
70
  method_source (0.9.2)
71
71
  mini_portile2 (2.4.0)
72
- minitest (5.11.3)
72
+ minitest (5.12.2)
73
73
  morpher (0.2.6)
74
74
  abstract_type (~> 0.0.7)
75
75
  adamantium (~> 0.2.0)
@@ -98,7 +98,7 @@ GEM
98
98
  mutant-rspec (0.8.14)
99
99
  mutant (~> 0.8.14)
100
100
  rspec-core (>= 3.4.0, < 3.7.0)
101
- nokogiri (1.10.2)
101
+ nokogiri (1.10.8)
102
102
  mini_portile2 (~> 2.4.0)
103
103
  paper_trail (10.2.1)
104
104
  activerecord (>= 4.2, < 6.1)
@@ -109,30 +109,31 @@ GEM
109
109
  pg (0.18.4)
110
110
  powerpack (0.1.1)
111
111
  procto (0.0.3)
112
- rack (2.0.6)
112
+ rack (2.2.3)
113
113
  rack-test (1.1.0)
114
114
  rack (>= 1.0, < 3)
115
115
  rails-dom-testing (2.0.3)
116
116
  activesupport (>= 4.2.0)
117
117
  nokogiri (>= 1.6)
118
- rails-html-sanitizer (1.0.4)
118
+ rails-html-sanitizer (1.2.0)
119
119
  loofah (~> 2.2, >= 2.2.2)
120
- railties (5.2.2.1)
121
- actionpack (= 5.2.2.1)
122
- activesupport (= 5.2.2.1)
120
+ railties (5.2.3)
121
+ actionpack (= 5.2.3)
122
+ activesupport (= 5.2.3)
123
123
  method_source
124
124
  rake (>= 0.8.7)
125
125
  thor (>= 0.19.0, < 2.0)
126
126
  rainbow (3.0.0)
127
- rake (10.4.2)
127
+ rake (13.0.1)
128
128
  regexp_parser (0.4.9)
129
- request_store (1.4.1)
129
+ request_store (1.5.0)
130
130
  rack (>= 1.4)
131
131
  rspec-core (3.6.0)
132
132
  rspec-support (~> 3.6.0)
133
133
  rspec-expectations (3.6.0)
134
134
  diff-lcs (>= 1.2.0, < 2.0)
135
135
  rspec-support (~> 3.6.0)
136
+ rspec-jumpstart (1.1.2)
136
137
  rspec-mocks (3.6.0)
137
138
  diff-lcs (>= 1.2.0, < 2.0)
138
139
  rspec-support (~> 3.6.0)
@@ -179,19 +180,21 @@ GEM
179
180
 
180
181
  PLATFORMS
181
182
  ruby
183
+ x86_64-darwin-20
182
184
 
183
185
  DEPENDENCIES
184
186
  codeclimate-test-reporter (~> 1.0.7)
185
187
  database_cleaner (~> 1.2)
186
188
  ffaker (~> 2.5)
187
- loofah (~> 2.2.3)
189
+ loofah (~> 2.3.1)
188
190
  mutant
189
191
  mutant-rspec
190
192
  paper_trail_scrapbook!
191
193
  pg (= 0.18.4)
192
194
  rack (>= 2.0.6)
193
- railties (= 5.2.2.1)
194
- rake (~> 10.4.2)
195
+ railties (= 5.2.3)
196
+ rake (~> 13.0.1)
197
+ rspec-jumpstart
195
198
  rspec-rails
196
199
  rspec_junit_formatter
197
200
  rubocop
@@ -200,4 +203,4 @@ DEPENDENCIES
200
203
  timecop (~> 0.8.0)
201
204
 
202
205
  BUNDLED WITH
203
- 2.0.1
206
+ 2.2.2
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Paper Trail Scrapbook
2
2
 
3
- [![CircleCI](https://circleci.com/gh/tjchambers/paper_trail_scrapbook/tree/master.svg?style=svg)](https://circleci.com/gh/tjchambers/paper_trail_scrapbook/tree/master)
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)
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.
@@ -16,9 +16,9 @@ Add PaperTrailScrapBook to your `Gemfile`.
16
16
  ### Configuration
17
17
 
18
18
  This gem is dependent on [PaperTrail](https://github.com/paper-trail-gem/paper_trail),
19
- and specifically, on the `object_changes` column in the `PaperTrail::Version`
19
+ and specifically, on the `object_changes` column in the `PaperTrail::Version`
20
20
  table. If your `PaperTrail` installation does not include this column, you can
21
- add it manually, or re-runthe `PaperTrail` generator:
21
+ add it manually, or re-run the `PaperTrail` generator:
22
22
 
23
23
  ```
24
24
  bundle exec rake generate paper_trail:install --with_changes
@@ -78,12 +78,12 @@ widget = Widget.find 42
78
78
  text = PaperTrailScrapbook::LifeHistory.new(widget).story
79
79
  # On Wednesday, 07 Jun 2017 at 2:37 PM, Rob Owens created the following Widget information:
80
80
  # • email: Tim@example.com
81
- # • name: Tim's Widget
81
+ # • name: Tim's Widget
82
82
  # • built: true
83
83
  # • created_by: Rob Owens[1742]
84
84
  # • provider: RedCharge[3113]
85
85
  # • cost: 29612.0
86
- # • discounted_price: 29612.0
86
+ # • discounted_price: 29612.0
87
87
  ```
88
88
 
89
89
  If desired, you can implement a `trailed_related_content` method in your model
@@ -118,18 +118,64 @@ text = PaperTrailScrapbook::LifeHistory.new(widget).story
118
118
  #
119
119
  # On Wednesday, 07 Jun 2017 at 2:37 PM, Rob Owens created the following Widget information:
120
120
  # • email: Tim@example.com
121
- # • name: Tim's Widget
121
+ # • name: Tim's Widget
122
122
  # • manufacturer: WidgetsAreUs[411]
123
123
  # •: 1234
124
- #
124
+ #
125
125
  # On Thursday, 23 Oct 2017 at 7:55 AM PDT, Rob Owens updated Manufacturer[411]:
126
126
  # • name: WidgetsRUs
127
- #
127
+ #
128
128
  # On Friday, 24 Oct 2017 at 10:10 AM PDT, Rob Owens created the following Attachment[212] information:
129
129
  # • name: Electromagnet
130
130
  # • widget: Tim's Widget[1234]
131
131
  # •: 212
132
- #
132
+ #
133
+ ```
134
+
135
+ `PaperTrailScrapbook` also implements a `version_filter` hook to provide a flexible way to filter which versions appear in a object's history. For example, if we only wanted our `Widget` class to include history for its manufacturer after the widget was created, we might implement `Widget#version_filter` like this:
136
+
137
+ ```ruby
138
+ class Widget < ApplicationRecord
139
+ has_paper_trail
140
+
141
+ def trailed_related_content
142
+ attachments | [manufacturer]
143
+ end
144
+
145
+ def version_filter(version)
146
+ case version.item_type
147
+ when 'Manufacturer'
148
+ if version.created_at < created_at
149
+ return nil
150
+ end
151
+ end
152
+ version
153
+ end
154
+
155
+ ...
156
+ ```
157
+
158
+ Then, the above history would be:
159
+
160
+ ```ruby
161
+ widget = Widget.find 42
162
+
163
+ text = PaperTrailScrapbook::LifeHistory.new(widget).story
164
+
165
+ # On Wednesday, 07 Jun 2017 at 2:37 PM, Rob Owens created the following Widget information:
166
+ # • email: Tim@example.com
167
+ # • name: Tim's Widget
168
+ # • manufacturer: WidgetsAreUs[411]
169
+ # •: 1234
170
+ #
171
+ # On Thursday, 23 Oct 2017 at 7:55 AM PDT, Rob Owens updated Manufacturer[411]:
172
+ # • name: WidgetsRUs
173
+ #
174
+ # On Friday, 24 Oct 2017 at 10:10 AM PDT, Rob Owens created the following Attachment[212] information:
175
+ # • name: Electromagnet
176
+ # • widget: Tim's Widget[1234]
177
+ # •: 212
178
+ #
133
179
  ```
134
180
 
135
181
  ### User Journal
@@ -199,7 +245,7 @@ text = PaperTrailScrapbook::UserJournal.new(who, start: 1.month.ago, end: Time.n
199
245
 
200
246
  ## Problems
201
247
 
202
- Please use GitHub's [issue tracker](http://github.com/tjchambers/paper_trail_scrapbook/issues).
248
+ Please use GitHub's [issue tracker](http://github.com/hintmedia/paper_trail_scrapbook/issues).
203
249
 
204
250
 
205
251
  ## Contributors
@@ -215,7 +261,7 @@ possible.
215
261
 
216
262
  ## Intellectual Property
217
263
 
218
- Copyright (c) 2017 Tim Chambers (tim@possibilogy.com).
264
+ Copyright (c) 2017 Hint Media, Inc.
219
265
  Released under the MIT licence.
220
266
 
221
267
 
@@ -14,6 +14,7 @@ require 'paper_trail_scrapbook/secondary_chapter'
14
14
  require 'paper_trail_scrapbook/user_journal'
15
15
  require 'paper_trail_scrapbook/version'
16
16
  require 'paper_trail_scrapbook/version_helpers'
17
+ require 'paper_trail_scrapbook/versions'
17
18
 
18
19
  # Library namespace
19
20
  #
@@ -3,7 +3,7 @@
3
3
  module PaperTrailScrapbook
4
4
  # Class Changes provides detailed attribute by attribute analysis
5
5
  #
6
- # @author Timothy Chambers <tim@possibilogy.com>
6
+ # @author Timothy Chambers <tim@hint.io>
7
7
  #
8
8
  class Changes
9
9
  include Concord.new(:version)
@@ -5,7 +5,7 @@ require_relative 'version_helpers'
5
5
  module PaperTrailScrapbook
6
6
  # Class Chapter provides single version history analysis
7
7
  #
8
- # @author Timothy Chambers <tim@possibilogy.com>
8
+ # @author Timothy Chambers <tim@hint.io>
9
9
  #
10
10
  class Chapter
11
11
  include Concord.new(:version)
@@ -5,7 +5,7 @@ require_relative 'version_helpers'
5
5
  module PaperTrailScrapbook
6
6
  # Class JournalEntry provides single version history analysis
7
7
  #
8
- # @author Jason Dinsmore <jason@dinjas.com>
8
+ # @author Jason Dinsmore <jason@hint.io>
9
9
  #
10
10
  class JournalEntry
11
11
  include Concord.new(:version)
@@ -3,19 +3,12 @@
3
3
  module PaperTrailScrapbook
4
4
  # Class LifeHistory provides Full multi version history
5
5
  #
6
- # @author Timothy Chambers <tim@possibilogy.com>
6
+ # @author Timothy Chambers <tim@hint.io>
7
7
  #
8
8
  class LifeHistory
9
9
  def initialize(object)
10
10
  @object = object
11
- @versions = object.versions
12
- if object.respond_to?(:trailed_related_content)
13
- object.trailed_related_content.compact.each do |trc|
14
- @versions |= trc.versions
15
- end
16
- end
17
-
18
- @versions = @versions.sort_by(&:created_at)
11
+ @versions = Versions.new(object).versions
19
12
  end
20
13
 
21
14
  # Retries textual historical analysis of versions
@@ -4,7 +4,7 @@ module PaperTrailScrapbook
4
4
  # Class UserJournal provides history for a user, optionally scoped by
5
5
  # object class and/or date range
6
6
  #
7
- # @author Jason Dinsmore <jason@dinjas.com>
7
+ # @author Jason Dinsmore <jason@hint.io>
8
8
  #
9
9
  class UserJournal
10
10
  include Adamantium::Flat
@@ -2,5 +2,5 @@
2
2
 
3
3
  module PaperTrailScrapbook
4
4
  # Current version
5
- VERSION = '0.1.15'
5
+ VERSION = '0.1.20'
6
6
  end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ module PaperTrailScrapbook
4
+ class Versions
5
+ include Concord.new(:object)
6
+
7
+ def versions
8
+ filtered(object.versions | related_content).sort_by(&:created_at)
9
+ end
10
+
11
+ def related_content
12
+ unless object.respond_to?(:trailed_related_content)
13
+ return []
14
+ end
15
+
16
+ object.trailed_related_content.compact.flat_map(&:versions)
17
+ end
18
+
19
+ def filtered(object_versions)
20
+ unless object.respond_to?(:version_filter)
21
+ return object_versions
22
+ end
23
+
24
+ object_versions.select { |v| object.version_filter(v) }
25
+ end
26
+
27
+ end
28
+
29
+ end
@@ -9,9 +9,9 @@ Gem::Specification.new do |gem|
9
9
  gem.summary = 'Paper Trail Scrapbook'
10
10
  gem.description = "Human Readable Change Log for Paper Trail'd data"
11
11
  gem.authors = ['Timothy Chambers']
12
- gem.email = 'tim@possibilogy.com'
12
+ gem.email = 'tim@hint.io'
13
13
  gem.files = `git ls-files`.split("\n")
14
- gem.homepage = 'https://github.com/tjchambers/paper_trail_scrapbook'
14
+ gem.homepage = 'https://github.com/hintmedia/paper_trail_scrapbook'
15
15
  gem.license = 'MIT'
16
16
 
17
17
  gem.required_rubygems_version = '>= 1.3.6'
@@ -24,18 +24,19 @@ Gem::Specification.new do |gem|
24
24
  gem.add_dependency 'paper_trail', ['>= 5.2', '<= 10.2.1']
25
25
 
26
26
  gem.add_development_dependency 'ffaker', '~> 2.5'
27
- gem.add_development_dependency 'rake', '~> 10.4.2'
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.2.1'
30
+ gem.add_development_dependency 'railties', '= 5.2.3'
31
31
 
32
32
  gem.add_development_dependency 'codeclimate-test-reporter', '~> 1.0.7'
33
33
  gem.add_development_dependency 'database_cleaner', '~> 1.2'
34
- gem.add_development_dependency 'loofah', '~> 2.2.3'
34
+ gem.add_development_dependency 'loofah', '~> 2.3.1'
35
35
  gem.add_development_dependency 'mutant'
36
36
  gem.add_development_dependency 'mutant-rspec'
37
37
  gem.add_development_dependency 'pg', '= 0.18.4'
38
38
  gem.add_development_dependency 'rspec-rails'
39
+ gem.add_development_dependency 'rspec-jumpstart'
39
40
  gem.add_development_dependency 'rspec_junit_formatter'
40
41
  gem.add_development_dependency 'rubocop'
41
42
  gem.add_development_dependency 'rubocop-rspec'
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+ require './lib/paper_trail_scrapbook/journal_entry'
5
+
6
+ RSpec.describe PaperTrailScrapbook::JournalEntry do
7
+ let(:person) { Person.create!(name: 'The Tim Man') }
8
+ let(:book) { Book.create!(title: 'How the Grinch stole Xmas') }
9
+ let(:version) do
10
+ OpenStruct.new(event: 'create',
11
+ item_type: 'Book',
12
+ item_id: book.id,
13
+ created_at: whenn,
14
+ version_author: person.id)
15
+ end
16
+ let(:subject) { described_class.new(version) }
17
+ let(:whenn) { Time.parse('2019-12-16 12:01:29 -0800') }
18
+
19
+ describe '#story' do
20
+ it 'story' do
21
+ result = subject.story
22
+
23
+ expect(result).to eql('On Monday, 16 Dec 2019 at 12:01 PM, '\
24
+ "created Book[#{book.id}]:\n")
25
+ end
26
+ end
27
+
28
+ end
@@ -0,0 +1,94 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ module PaperTrailScrapbook
6
+ ::RSpec.describe Versions do
7
+ before do
8
+ PaperTrailScrapbook.config.whodunnit_class = Person
9
+ PaperTrail.request.whodunnit = person.id
10
+ end
11
+
12
+ let(:book) do
13
+ Book.new(title: 'How the Grinch stole Xmas').tap(&:save!)
14
+ end
15
+ let(:person) { Person.create(name: 'The Tim Man') }
16
+ let!(:authorship) do
17
+ Authorship.new(book: book, author: person).tap(&:save!)
18
+ end
19
+
20
+ let(:object) { described_class.new(book) }
21
+
22
+ describe '#versions' do
23
+ it 'versions' do
24
+ book.update!(title: 'New Title')
25
+
26
+ result = object.versions
27
+
28
+ expect(result).to eql(book.versions.to_a)
29
+ expect(result.size).to equal(2)
30
+ end
31
+ end
32
+
33
+ describe '#related_content' do
34
+ it 'related_content returns nothing if no related content' do
35
+ result = object.related_content
36
+
37
+ expect(result).to eql([])
38
+ end
39
+
40
+ it 'returns related content' do
41
+ allow(book).to receive(:respond_to?)
42
+ .with(:trailed_related_content).and_return(true)
43
+ allow(book).to receive(:respond_to?)
44
+ .with(:trailed_related_content, true).and_return(true)
45
+ allow(book).to receive(:trailed_related_content) do
46
+ book.authorships
47
+ end
48
+
49
+ result = object.related_content
50
+
51
+ expect(result).to eql(authorship.versions.to_a)
52
+ end
53
+ end
54
+
55
+ describe '#filtered' do
56
+ it 'returns versions if no filter' do
57
+ result = object.filtered(book.versions.to_a)
58
+
59
+ expect(result).to eql(book.versions.to_a)
60
+ end
61
+
62
+ it 'returns filtered versions if filter' do
63
+ allow(book).to receive(:respond_to?)
64
+ .with(:version_filter, true).and_return(true)
65
+ allow(book).to receive(:respond_to?)
66
+ .with(:version_filter).and_return(true)
67
+ allow(book).to receive(:version_filter) do |_version|
68
+ nil
69
+ end
70
+
71
+ result = object.filtered(book.versions.to_a)
72
+
73
+ expect(result).to eql([])
74
+ end
75
+
76
+ it 'returns filtered versions if filter' do
77
+ book.update!(title: 'New Title')
78
+
79
+ allow(book).to receive(:respond_to?).with(:version_filter, true).and_return(true)
80
+ allow(book).to receive(:respond_to?).with(:version_filter).and_return(true)
81
+ allow(book).to receive(:version_filter) do |version|
82
+ if version.event.eql?('update')
83
+ version
84
+ end
85
+ end
86
+
87
+ result = object.filtered(book.versions)
88
+
89
+ expect(result).to eql([book.versions.last])
90
+ expect(result.size).not_to eql(book.versions.size)
91
+ end
92
+ end
93
+ end
94
+ end
@@ -2,5 +2,13 @@
2
2
 
3
3
  require 'spec_helper'
4
4
 
5
- module PaperTrailScrapbook
5
+ RSpec.describe PaperTrailScrapbook do
6
+ describe '.config' do
7
+ it 'sets the @config ivar' do
8
+ described_class.config
9
+
10
+ expect(described_class.instance_variable_get(:@config))
11
+ .to equal(PaperTrailScrapbook::Config.instance)
12
+ end
13
+ end
6
14
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: paper_trail_scrapbook
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.15
4
+ version: 0.1.20
5
5
  platform: ruby
6
6
  authors:
7
7
  - Timothy Chambers
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-04-01 00:00:00.000000000 Z
11
+ date: 2020-12-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -92,28 +92,28 @@ dependencies:
92
92
  requirements:
93
93
  - - "~>"
94
94
  - !ruby/object:Gem::Version
95
- version: 10.4.2
95
+ version: 13.0.1
96
96
  type: :development
97
97
  prerelease: false
98
98
  version_requirements: !ruby/object:Gem::Requirement
99
99
  requirements:
100
100
  - - "~>"
101
101
  - !ruby/object:Gem::Version
102
- version: 10.4.2
102
+ version: 13.0.1
103
103
  - !ruby/object:Gem::Dependency
104
104
  name: railties
105
105
  requirement: !ruby/object:Gem::Requirement
106
106
  requirements:
107
107
  - - '='
108
108
  - !ruby/object:Gem::Version
109
- version: 5.2.2.1
109
+ version: 5.2.3
110
110
  type: :development
111
111
  prerelease: false
112
112
  version_requirements: !ruby/object:Gem::Requirement
113
113
  requirements:
114
114
  - - '='
115
115
  - !ruby/object:Gem::Version
116
- version: 5.2.2.1
116
+ version: 5.2.3
117
117
  - !ruby/object:Gem::Dependency
118
118
  name: codeclimate-test-reporter
119
119
  requirement: !ruby/object:Gem::Requirement
@@ -148,14 +148,14 @@ dependencies:
148
148
  requirements:
149
149
  - - "~>"
150
150
  - !ruby/object:Gem::Version
151
- version: 2.2.3
151
+ version: 2.3.1
152
152
  type: :development
153
153
  prerelease: false
154
154
  version_requirements: !ruby/object:Gem::Requirement
155
155
  requirements:
156
156
  - - "~>"
157
157
  - !ruby/object:Gem::Version
158
- version: 2.2.3
158
+ version: 2.3.1
159
159
  - !ruby/object:Gem::Dependency
160
160
  name: mutant
161
161
  requirement: !ruby/object:Gem::Requirement
@@ -212,6 +212,20 @@ dependencies:
212
212
  - - ">="
213
213
  - !ruby/object:Gem::Version
214
214
  version: '0'
215
+ - !ruby/object:Gem::Dependency
216
+ name: rspec-jumpstart
217
+ requirement: !ruby/object:Gem::Requirement
218
+ requirements:
219
+ - - ">="
220
+ - !ruby/object:Gem::Version
221
+ version: '0'
222
+ type: :development
223
+ prerelease: false
224
+ version_requirements: !ruby/object:Gem::Requirement
225
+ requirements:
226
+ - - ">="
227
+ - !ruby/object:Gem::Version
228
+ version: '0'
215
229
  - !ruby/object:Gem::Dependency
216
230
  name: rspec_junit_formatter
217
231
  requirement: !ruby/object:Gem::Requirement
@@ -297,7 +311,7 @@ dependencies:
297
311
  - !ruby/object:Gem::Version
298
312
  version: 2.0.6
299
313
  description: Human Readable Change Log for Paper Trail'd data
300
- email: tim@possibilogy.com
314
+ email: tim@hint.io
301
315
  executables: []
302
316
  extensions: []
303
317
  extra_rdoc_files: []
@@ -326,9 +340,12 @@ files:
326
340
  - lib/paper_trail_scrapbook/user_journal.rb
327
341
  - lib/paper_trail_scrapbook/version.rb
328
342
  - lib/paper_trail_scrapbook/version_helpers.rb
343
+ - lib/paper_trail_scrapbook/versions.rb
329
344
  - log/mutant/pts.log
330
345
  - paper_trail_scrapbook.gemspec
331
346
  - pkg/paper_trail_scrapbook-0.0.2.gem
347
+ - pkg/paper_trail_scrapbook-0.1.18.gem
348
+ - pkg/paper_trail_scrapbook-0.1.19.gem
332
349
  - pkg/paper_trail_scrapbook-0.1.6.gem
333
350
  - pkg/paper_trail_scrapbook-0.1.7.gem
334
351
  - spec/dummy_app/Rakefile
@@ -405,14 +422,16 @@ files:
405
422
  - spec/paper_trail_scrapbook/changes_spec.rb
406
423
  - spec/paper_trail_scrapbook/chapter_spec.rb
407
424
  - spec/paper_trail_scrapbook/config_spec.rb
425
+ - spec/paper_trail_scrapbook/journal_entry_spec.rb
408
426
  - spec/paper_trail_scrapbook/life_history_spec.rb
409
427
  - spec/paper_trail_scrapbook/secondary_chapter_spec.rb
410
428
  - spec/paper_trail_scrapbook/user_journal_spec.rb
411
429
  - spec/paper_trail_scrapbook/version_helpers_spec.rb
412
430
  - spec/paper_trail_scrapbook/version_spec.rb
431
+ - spec/paper_trail_scrapbook/versions_spec.rb
413
432
  - spec/paper_trail_scrapbook_spec.rb
414
433
  - spec/spec_helper.rb
415
- homepage: https://github.com/tjchambers/paper_trail_scrapbook
434
+ homepage: https://github.com/hintmedia/paper_trail_scrapbook
416
435
  licenses:
417
436
  - MIT
418
437
  metadata: {}
@@ -431,8 +450,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
431
450
  - !ruby/object:Gem::Version
432
451
  version: 1.3.6
433
452
  requirements: []
434
- rubyforge_project:
435
- rubygems_version: 2.5.2.3
453
+ rubygems_version: 3.0.8
436
454
  signing_key:
437
455
  specification_version: 4
438
456
  summary: Paper Trail Scrapbook