paper_trail_scrapbook 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (100) hide show
  1. checksums.yaml +7 -0
  2. data/.codeclimate.yml +21 -0
  3. data/.rspec +5 -0
  4. data/.rubocop.yml +8 -0
  5. data/.ruby-gemset +1 -0
  6. data/Changelog.md +0 -0
  7. data/Gemfile +3 -0
  8. data/Gemfile.lock +141 -0
  9. data/LICENSE.md +21 -0
  10. data/README.md +77 -0
  11. data/Rakefile +24 -0
  12. data/circle.yml +10 -0
  13. data/lib/paper_trail_scrapbook/changes.rb +89 -0
  14. data/lib/paper_trail_scrapbook/chapter.rb +49 -0
  15. data/lib/paper_trail_scrapbook/config.rb +13 -0
  16. data/lib/paper_trail_scrapbook/life_history.rb +17 -0
  17. data/lib/paper_trail_scrapbook/version.rb +4 -0
  18. data/lib/paper_trail_scrapbook.rb +51 -0
  19. data/paper_trail_scrapbook.gemspec +38 -0
  20. data/spec/dummy_app/Rakefile +7 -0
  21. data/spec/dummy_app/app/models/animal.rb +4 -0
  22. data/spec/dummy_app/app/models/article.rb +24 -0
  23. data/spec/dummy_app/app/models/authorship.rb +5 -0
  24. data/spec/dummy_app/app/models/bar_habtm.rb +4 -0
  25. data/spec/dummy_app/app/models/book.rb +9 -0
  26. data/spec/dummy_app/app/models/boolit.rb +4 -0
  27. data/spec/dummy_app/app/models/callback_modifier.rb +45 -0
  28. data/spec/dummy_app/app/models/car.rb +3 -0
  29. data/spec/dummy_app/app/models/cat.rb +2 -0
  30. data/spec/dummy_app/app/models/chapter.rb +9 -0
  31. data/spec/dummy_app/app/models/citation.rb +5 -0
  32. data/spec/dummy_app/app/models/custom_primary_key_record.rb +15 -0
  33. data/spec/dummy_app/app/models/customer.rb +4 -0
  34. data/spec/dummy_app/app/models/document.rb +6 -0
  35. data/spec/dummy_app/app/models/dog.rb +2 -0
  36. data/spec/dummy_app/app/models/editor.rb +4 -0
  37. data/spec/dummy_app/app/models/editorship.rb +5 -0
  38. data/spec/dummy_app/app/models/elephant.rb +3 -0
  39. data/spec/dummy_app/app/models/fluxor.rb +3 -0
  40. data/spec/dummy_app/app/models/foo_habtm.rb +5 -0
  41. data/spec/dummy_app/app/models/foo_widget.rb +2 -0
  42. data/spec/dummy_app/app/models/fruit.rb +5 -0
  43. data/spec/dummy_app/app/models/gadget.rb +3 -0
  44. data/spec/dummy_app/app/models/kitchen/banana.rb +5 -0
  45. data/spec/dummy_app/app/models/legacy_widget.rb +3 -0
  46. data/spec/dummy_app/app/models/line_item.rb +4 -0
  47. data/spec/dummy_app/app/models/not_on_update.rb +4 -0
  48. data/spec/dummy_app/app/models/on/create.rb +6 -0
  49. data/spec/dummy_app/app/models/on/destroy.rb +6 -0
  50. data/spec/dummy_app/app/models/on/empty_array.rb +6 -0
  51. data/spec/dummy_app/app/models/on/update.rb +6 -0
  52. data/spec/dummy_app/app/models/order.rb +5 -0
  53. data/spec/dummy_app/app/models/paragraph.rb +5 -0
  54. data/spec/dummy_app/app/models/person.rb +39 -0
  55. data/spec/dummy_app/app/models/post.rb +3 -0
  56. data/spec/dummy_app/app/models/post_with_status.rb +7 -0
  57. data/spec/dummy_app/app/models/quotation.rb +5 -0
  58. data/spec/dummy_app/app/models/section.rb +6 -0
  59. data/spec/dummy_app/app/models/skipper.rb +3 -0
  60. data/spec/dummy_app/app/models/song.rb +37 -0
  61. data/spec/dummy_app/app/models/thing.rb +3 -0
  62. data/spec/dummy_app/app/models/translation.rb +6 -0
  63. data/spec/dummy_app/app/models/truck.rb +4 -0
  64. data/spec/dummy_app/app/models/vehicle.rb +4 -0
  65. data/spec/dummy_app/app/models/whatchamajigger.rb +4 -0
  66. data/spec/dummy_app/app/models/widget.rb +8 -0
  67. data/spec/dummy_app/app/models/wotsit.rb +8 -0
  68. data/spec/dummy_app/app/versions/custom_primary_key_record_version.rb +3 -0
  69. data/spec/dummy_app/app/versions/joined_version.rb +6 -0
  70. data/spec/dummy_app/app/versions/json_version.rb +3 -0
  71. data/spec/dummy_app/app/versions/kitchen/banana_version.rb +5 -0
  72. data/spec/dummy_app/app/versions/post_version.rb +3 -0
  73. data/spec/dummy_app/config/application.rb +37 -0
  74. data/spec/dummy_app/config/boot.rb +24 -0
  75. data/spec/dummy_app/config/database.sqlite.yml +15 -0
  76. data/spec/dummy_app/config/database.yml +15 -0
  77. data/spec/dummy_app/config/environment.rb +5 -0
  78. data/spec/dummy_app/config/environments/development.rb +36 -0
  79. data/spec/dummy_app/config/environments/production.rb +74 -0
  80. data/spec/dummy_app/config/environments/test.rb +46 -0
  81. data/spec/dummy_app/config/initializers/backtrace_silencers.rb +9 -0
  82. data/spec/dummy_app/config/initializers/inflections.rb +10 -0
  83. data/spec/dummy_app/config/initializers/mime_types.rb +5 -0
  84. data/spec/dummy_app/config/initializers/paper_trail.rb +1 -0
  85. data/spec/dummy_app/config/initializers/secret_token.rb +9 -0
  86. data/spec/dummy_app/config/initializers/session_store.rb +8 -0
  87. data/spec/dummy_app/config/locales/en.yml +5 -0
  88. data/spec/dummy_app/config/routes.rb +4 -0
  89. data/spec/dummy_app/config.ru +4 -0
  90. data/spec/dummy_app/db/migrate/20110208155312_set_up_test_tables.rb +344 -0
  91. data/spec/dummy_app/db/schema.rb +296 -0
  92. data/spec/dummy_app/db/test.sqlite3 +0 -0
  93. data/spec/paper_trail_scrapbook/changes_spec.rb +6 -0
  94. data/spec/paper_trail_scrapbook/chapter_spec.rb +6 -0
  95. data/spec/paper_trail_scrapbook/config_spec.rb +17 -0
  96. data/spec/paper_trail_scrapbook/life_history_spec.rb +6 -0
  97. data/spec/paper_trail_scrapbook/version_spec.rb +6 -0
  98. data/spec/paper_trail_scrapbook_spec.rb +4 -0
  99. data/spec/spec_helper.rb +73 -0
  100. metadata +363 -0
@@ -0,0 +1,296 @@
1
+ # This file is auto-generated from the current state of the database. Instead
2
+ # of editing this file, please use the migrations feature of Active Record to
3
+ # incrementally modify your database, and then regenerate this schema definition.
4
+ #
5
+ # Note that this schema.rb definition is the authoritative source for your
6
+ # database schema. If you need to create the application database on another
7
+ # system, you should be using db:schema:load, not running all the migrations
8
+ # from scratch. The latter is a flawed and unsustainable approach (the more migrations
9
+ # you'll amass, the slower it'll run and the greater likelihood for issues).
10
+ #
11
+ # It's strongly recommended that you check this file into your version control system.
12
+
13
+ ActiveRecord::Schema.define(version: 20_110_208_155_312) do
14
+ create_table 'animals', force: :cascade do |t|
15
+ t.string 'name'
16
+ t.string 'species'
17
+ end
18
+
19
+ create_table 'articles', force: :cascade do |t|
20
+ t.string 'title'
21
+ t.string 'content'
22
+ t.string 'abstract'
23
+ t.string 'file_upload'
24
+ end
25
+
26
+ create_table 'authorships', force: :cascade do |t|
27
+ t.integer 'book_id'
28
+ t.integer 'author_id'
29
+ end
30
+
31
+ create_table 'banana_versions', force: :cascade do |t|
32
+ t.string 'item_type', null: false
33
+ t.integer 'item_id', null: false
34
+ t.string 'event', null: false
35
+ t.string 'whodunnit'
36
+ t.text 'object'
37
+ t.datetime 'created_at'
38
+ t.index %w[item_type item_id], name: 'index_banana_versions_on_item_type_and_item_id'
39
+ end
40
+
41
+ create_table 'bananas', force: :cascade do |t|
42
+ t.datetime 'created_at'
43
+ t.datetime 'updated_at'
44
+ end
45
+
46
+ create_table 'bar_habtms', force: :cascade do |t|
47
+ t.string 'name'
48
+ end
49
+
50
+ create_table 'bar_habtms_foo_habtms', id: false, force: :cascade do |t|
51
+ t.integer 'foo_habtm_id'
52
+ t.integer 'bar_habtm_id'
53
+ t.index ['bar_habtm_id'], name: 'index_bar_habtms_foo_habtms_on_bar_habtm_id'
54
+ t.index ['foo_habtm_id'], name: 'index_bar_habtms_foo_habtms_on_foo_habtm_id'
55
+ end
56
+
57
+ create_table 'books', force: :cascade do |t|
58
+ t.string 'title'
59
+ end
60
+
61
+ create_table 'boolits', force: :cascade do |t|
62
+ t.string 'name'
63
+ t.boolean 'scoped', default: true
64
+ end
65
+
66
+ create_table 'callback_modifiers', force: :cascade do |t|
67
+ t.string 'some_content'
68
+ t.boolean 'deleted', default: false
69
+ end
70
+
71
+ create_table 'chapters', force: :cascade do |t|
72
+ t.string 'name'
73
+ end
74
+
75
+ create_table 'citations', force: :cascade do |t|
76
+ t.integer 'quotation_id'
77
+ end
78
+
79
+ create_table 'custom_primary_key_record_versions', force: :cascade do |t|
80
+ t.string 'item_type', null: false
81
+ t.string 'item_id', null: false
82
+ t.string 'event', null: false
83
+ t.string 'whodunnit'
84
+ t.text 'object'
85
+ t.datetime 'created_at'
86
+ t.index %w[item_type item_id], name: 'idx_cust_pk_item'
87
+ end
88
+
89
+ create_table 'custom_primary_key_records', primary_key: 'uuid', id: :string, force: :cascade do |t|
90
+ t.string 'name'
91
+ t.datetime 'created_at'
92
+ t.datetime 'updated_at'
93
+ t.index ['uuid'], name: 'sqlite_autoindex_custom_primary_key_records_1', unique: true
94
+ end
95
+
96
+ create_table 'customers', force: :cascade do |t|
97
+ t.string 'name'
98
+ end
99
+
100
+ create_table 'documents', force: :cascade do |t|
101
+ t.string 'name'
102
+ end
103
+
104
+ create_table 'editors', force: :cascade do |t|
105
+ t.string 'name'
106
+ end
107
+
108
+ create_table 'editorships', force: :cascade do |t|
109
+ t.integer 'book_id'
110
+ t.integer 'editor_id'
111
+ end
112
+
113
+ create_table 'fluxors', force: :cascade do |t|
114
+ t.integer 'widget_id'
115
+ t.string 'name'
116
+ end
117
+
118
+ create_table 'foo_habtms', force: :cascade do |t|
119
+ t.string 'name'
120
+ end
121
+
122
+ create_table 'fruits', force: :cascade do |t|
123
+ t.string 'name'
124
+ t.string 'color'
125
+ end
126
+
127
+ create_table 'gadgets', force: :cascade do |t|
128
+ t.string 'name'
129
+ t.string 'brand'
130
+ t.datetime 'created_at'
131
+ t.datetime 'updated_at'
132
+ end
133
+
134
+ create_table 'legacy_widgets', force: :cascade do |t|
135
+ t.string 'name'
136
+ t.integer 'version'
137
+ end
138
+
139
+ create_table 'line_items', force: :cascade do |t|
140
+ t.integer 'order_id'
141
+ t.string 'product'
142
+ end
143
+
144
+ create_table 'not_on_updates', force: :cascade do |t|
145
+ t.datetime 'created_at'
146
+ t.datetime 'updated_at'
147
+ end
148
+
149
+ create_table 'on_create', force: :cascade do |t|
150
+ t.string 'name', null: false
151
+ end
152
+
153
+ create_table 'on_destroy', force: :cascade do |t|
154
+ t.string 'name', null: false
155
+ end
156
+
157
+ create_table 'on_empty_array', force: :cascade do |t|
158
+ t.string 'name', null: false
159
+ end
160
+
161
+ create_table 'on_update', force: :cascade do |t|
162
+ t.string 'name', null: false
163
+ end
164
+
165
+ create_table 'orders', force: :cascade do |t|
166
+ t.integer 'customer_id'
167
+ t.string 'order_date'
168
+ end
169
+
170
+ create_table 'paragraphs', force: :cascade do |t|
171
+ t.integer 'section_id'
172
+ t.string 'name'
173
+ end
174
+
175
+ create_table 'people', force: :cascade do |t|
176
+ t.string 'name'
177
+ t.string 'time_zone'
178
+ t.integer 'mentor_id'
179
+ end
180
+
181
+ create_table 'post_versions', force: :cascade do |t|
182
+ t.string 'item_type', null: false
183
+ t.integer 'item_id', null: false
184
+ t.string 'event', null: false
185
+ t.string 'whodunnit'
186
+ t.text 'object'
187
+ t.datetime 'created_at'
188
+ t.string 'ip'
189
+ t.string 'user_agent'
190
+ t.index %w[item_type item_id], name: 'index_post_versions_on_item_type_and_item_id'
191
+ end
192
+
193
+ create_table 'post_with_statuses', force: :cascade do |t|
194
+ t.integer 'status'
195
+ t.datetime 'created_at', null: false
196
+ t.datetime 'updated_at', null: false
197
+ end
198
+
199
+ create_table 'posts', force: :cascade do |t|
200
+ t.string 'title'
201
+ t.string 'content'
202
+ end
203
+
204
+ create_table 'quotations', force: :cascade do |t|
205
+ t.integer 'chapter_id'
206
+ end
207
+
208
+ create_table 'sections', force: :cascade do |t|
209
+ t.integer 'chapter_id'
210
+ t.string 'name'
211
+ end
212
+
213
+ create_table 'skippers', force: :cascade do |t|
214
+ t.string 'name'
215
+ t.datetime 'another_timestamp'
216
+ t.datetime 'created_at'
217
+ t.datetime 'updated_at'
218
+ end
219
+
220
+ create_table 'songs', force: :cascade do |t|
221
+ t.integer 'length'
222
+ end
223
+
224
+ create_table 'things', force: :cascade do |t|
225
+ t.string 'name'
226
+ end
227
+
228
+ create_table 'translations', force: :cascade do |t|
229
+ t.string 'headline'
230
+ t.string 'content'
231
+ t.string 'language_code'
232
+ t.string 'type'
233
+ end
234
+
235
+ create_table 'vehicles', force: :cascade do |t|
236
+ t.string 'name', null: false
237
+ t.string 'type', null: false
238
+ t.datetime 'created_at', null: false
239
+ t.datetime 'updated_at', null: false
240
+ end
241
+
242
+ create_table 'version_associations', force: :cascade do |t|
243
+ t.integer 'version_id'
244
+ t.string 'foreign_key_name', null: false
245
+ t.integer 'foreign_key_id'
246
+ t.index %w[foreign_key_name foreign_key_id], name: 'index_version_associations_on_foreign_key'
247
+ t.index ['version_id'], name: 'index_version_associations_on_version_id'
248
+ end
249
+
250
+ create_table 'versions', force: :cascade do |t|
251
+ t.string 'item_type', null: false
252
+ t.integer 'item_id', null: false
253
+ t.string 'event', null: false
254
+ t.string 'whodunnit'
255
+ t.text 'object', limit: 1_073_741_823
256
+ t.text 'object_changes', limit: 1_073_741_823
257
+ t.integer 'transaction_id'
258
+ t.datetime 'created_at'
259
+ t.integer 'answer'
260
+ t.string 'action'
261
+ t.string 'question'
262
+ t.integer 'article_id'
263
+ t.string 'title'
264
+ t.string 'ip'
265
+ t.string 'user_agent'
266
+ t.index %w[item_type item_id], name: 'index_versions_on_item_type_and_item_id'
267
+ end
268
+
269
+ create_table 'whatchamajiggers', force: :cascade do |t|
270
+ t.string 'owner_type'
271
+ t.integer 'owner_id'
272
+ t.string 'name'
273
+ end
274
+
275
+ create_table 'widgets', force: :cascade do |t|
276
+ t.string 'name'
277
+ t.text 'a_text'
278
+ t.integer 'an_integer'
279
+ t.float 'a_float'
280
+ t.decimal 'a_decimal', precision: 6, scale: 4
281
+ t.datetime 'a_datetime'
282
+ t.time 'a_time'
283
+ t.date 'a_date'
284
+ t.boolean 'a_boolean'
285
+ t.string 'type'
286
+ t.datetime 'created_at'
287
+ t.datetime 'updated_at'
288
+ end
289
+
290
+ create_table 'wotsits', force: :cascade do |t|
291
+ t.integer 'widget_id'
292
+ t.string 'name'
293
+ t.datetime 'created_at'
294
+ t.datetime 'updated_at'
295
+ end
296
+ end
Binary file
@@ -0,0 +1,6 @@
1
+ require 'spec_helper'
2
+
3
+ module PaperTrailScrapbook
4
+ ::RSpec.describe Changes do
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ require 'spec_helper'
2
+
3
+ module PaperTrailScrapbook
4
+ ::RSpec.describe Chapter do
5
+ end
6
+ end
@@ -0,0 +1,17 @@
1
+ require 'spec_helper'
2
+
3
+ module PaperTrailScrapbook
4
+ ::RSpec.describe Config do
5
+ describe '.instance' do
6
+ it 'returns the singleton instance' do
7
+ expect { described_class.instance }.not_to raise_error
8
+ end
9
+ end
10
+
11
+ describe '.new' do
12
+ it 'raises NoMethodError' do
13
+ expect { described_class.new }.to raise_error(NoMethodError)
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,6 @@
1
+ require 'spec_helper'
2
+
3
+ module PaperTrailScrapbook
4
+ ::RSpec.describe LifeHistory do
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ require 'spec_helper'
2
+
3
+ module PaperTrailScrapbook
4
+ ::RSpec.describe VERSION do
5
+ end
6
+ end
@@ -0,0 +1,4 @@
1
+ require 'spec_helper'
2
+
3
+ module PaperTrailScrapbook
4
+ end
@@ -0,0 +1,73 @@
1
+ # This file is copied to spec/ when you run 'rails generate rspec:install'
2
+ ENV['RAILS_ENV'] ||= 'test'
3
+ ENV['DB'] ||= 'sqlite'
4
+
5
+ unless File.exist?(File.expand_path('dummy_app/config/database.yml', __dir__))
6
+ warn 'WARNING: No database.yml detected for the dummy app, please run `rake prepare` first'
7
+ end
8
+
9
+ RSpec.configure do |config|
10
+ config.expect_with :rspec do |expectations|
11
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
12
+ end
13
+
14
+ config.mock_with :rspec do |mocks|
15
+ mocks.verify_partial_doubles = true
16
+ end
17
+
18
+ # Support for disabling `verify_partial_doubles` on specific examples.
19
+ config.around(:each, verify_stubs: false) do |ex|
20
+ config.mock_with :rspec do |mocks|
21
+ mocks.verify_partial_doubles = false
22
+ ex.run
23
+ mocks.verify_partial_doubles = true
24
+ end
25
+ end
26
+
27
+ config.filter_run :focus
28
+ config.run_all_when_everything_filtered = true
29
+ config.disable_monkey_patching!
30
+ config.warnings = false
31
+ config.default_formatter = 'doc' if config.files_to_run.one?
32
+ config.order = :random
33
+ Kernel.srand config.seed
34
+ end
35
+
36
+ def active_record_gem_version
37
+ Gem::Version.new(ActiveRecord::VERSION::STRING)
38
+ end
39
+
40
+ # Wrap args in a hash to support the ActionController::TestCase and
41
+ # ActionDispatch::Integration HTTP request method switch to keyword args
42
+ # (see https://github.com/rails/rails/blob/master/actionpack/CHANGELOG.md)
43
+ def params_wrapper(args)
44
+ if defined?(::Rails) && active_record_gem_version >= Gem::Version.new('5.0.0.beta1')
45
+ { params: args }
46
+ else
47
+ args
48
+ end
49
+ end
50
+
51
+ require File.expand_path('../dummy_app/config/environment', __FILE__)
52
+ require 'rspec/rails'
53
+ require 'ffaker'
54
+ require 'timecop'
55
+
56
+ # Run any available migration
57
+ ActiveRecord::Migrator.migrate File.expand_path('dummy_app/db/migrate/', __dir__)
58
+
59
+ require 'database_cleaner'
60
+ DatabaseCleaner.strategy = :truncation
61
+
62
+ RSpec.configure do |config|
63
+ config.fixture_path = "#{::Rails.root}/spec/fixtures"
64
+ config.use_transactional_fixtures = active_record_gem_version >= ::Gem::Version.new('5')
65
+
66
+ # In rails < 5, some tests seem to require DatabaseCleaner-truncation.
67
+ # Truncation is about three times slower than transaction rollback, so it'll
68
+ # be nice when we can drop support for rails < 5.
69
+ if active_record_gem_version < ::Gem::Version.new('5')
70
+ config.before(:each) { DatabaseCleaner.start }
71
+ config.after(:each) { DatabaseCleaner.clean }
72
+ end
73
+ end