historiographer 4.4.5 → 4.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +1 -2
- data/VERSION +1 -1
- data/historiographer.gemspec +4 -4
- data/lib/historiographer/configuration.rb +9 -0
- data/lib/historiographer/safe.rb +3 -2
- data/lib/historiographer/silent.rb +1 -1
- data/lib/historiographer/version.rb +1 -1
- data/spec/examples.txt +66 -63
- data/spec/historiographer_spec.rb +65 -8
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c759629dfbf2b3406b0f638fa69eef2a1858cd4fab4172d2e3fa9dd6256337d2
|
|
4
|
+
data.tar.gz: d03d872975e0583cffb0a6a0c61e7f8164e4e69eb1993fefd160a63e3bdd9f59
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7de02fafe59b9f945ae40fcf74981ab0b5148a8539914310fee904b140c7a22ca687513f7cd47e46da7f16c712ab18e531074d8e0e457df15fb80e538533d814
|
|
7
|
+
data.tar.gz: 7b7650c837a817580e6c525ebc01fb176641d2bad79ad93bf901e04d7ceb5c7a0b8002f1e1ed40a72c78a5eab985b0168e96a0b40f3b2e6c598dd82c7340ad9a
|
data/Gemfile
CHANGED
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
4.
|
|
1
|
+
4.5.0
|
data/historiographer.gemspec
CHANGED
|
@@ -2,16 +2,16 @@
|
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
|
4
4
|
# -*- encoding: utf-8 -*-
|
|
5
|
-
# stub: historiographer 4.
|
|
5
|
+
# stub: historiographer 4.5.0 ruby lib
|
|
6
6
|
|
|
7
7
|
Gem::Specification.new do |s|
|
|
8
8
|
s.name = "historiographer".freeze
|
|
9
|
-
s.version = "4.
|
|
9
|
+
s.version = "4.5.0"
|
|
10
10
|
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
|
12
12
|
s.require_paths = ["lib".freeze]
|
|
13
13
|
s.authors = ["brettshollenberger".freeze]
|
|
14
|
-
s.date = "2026-
|
|
14
|
+
s.date = "2026-02-19"
|
|
15
15
|
s.description = "Creates separate tables for each history table".freeze
|
|
16
16
|
s.email = "brett.shollenberger@gmail.com".freeze
|
|
17
17
|
s.executables = ["console".freeze, "setup".freeze, "test".freeze, "test-all".freeze, "test-rails".freeze]
|
|
@@ -155,7 +155,7 @@ Gem::Specification.new do |s|
|
|
|
155
155
|
s.add_runtime_dependency(%q<activerecord-import>.freeze, [">= 0"])
|
|
156
156
|
s.add_runtime_dependency(%q<activesupport>.freeze, [">= 0"])
|
|
157
157
|
s.add_runtime_dependency(%q<rails>.freeze, [">= 6"])
|
|
158
|
-
s.
|
|
158
|
+
s.add_development_dependency(%q<rollbar>.freeze, [">= 0"])
|
|
159
159
|
s.add_development_dependency(%q<mysql2>.freeze, ["= 0.5"])
|
|
160
160
|
s.add_development_dependency(%q<paranoia>.freeze, [">= 0"])
|
|
161
161
|
s.add_development_dependency(%q<pg>.freeze, [">= 0"])
|
|
@@ -7,6 +7,15 @@ module Historiographer
|
|
|
7
7
|
OPTS = {
|
|
8
8
|
mode: {
|
|
9
9
|
default: :histories
|
|
10
|
+
},
|
|
11
|
+
error_notifier: {
|
|
12
|
+
default: ->(message) {
|
|
13
|
+
if defined?(Rollbar)
|
|
14
|
+
Rollbar.error(message)
|
|
15
|
+
elsif defined?(Rails) && Rails.logger
|
|
16
|
+
Rails.logger.error(message)
|
|
17
|
+
end
|
|
18
|
+
}
|
|
10
19
|
}
|
|
11
20
|
}
|
|
12
21
|
OPTS.each do |key, options|
|
data/lib/historiographer/safe.rb
CHANGED
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
# Historiographer will throw an error if a model is saved without a user present,
|
|
5
5
|
# unless you explicitly call save_without_history.
|
|
6
6
|
#
|
|
7
|
-
# Historiographer::Safe will not throw an error, but will rather
|
|
7
|
+
# Historiographer::Safe will not throw an error, but will rather notify via
|
|
8
|
+
# the configured error notifier (see Historiographer::Configuration.error_notifier),
|
|
8
9
|
# which enables a programmer to find all locations that need to be migrated,
|
|
9
10
|
# rather than allowing an unsafe migration to take place.
|
|
10
11
|
#
|
|
@@ -25,7 +26,7 @@ module Historiographer
|
|
|
25
26
|
private
|
|
26
27
|
|
|
27
28
|
def history_user_absent_action
|
|
28
|
-
|
|
29
|
+
Historiographer::Configuration.error_notifier.call("history_user_id must be passed in order to save record with histories! If you are in a context with no history_user_id, explicitly call #save_without_history")
|
|
29
30
|
end
|
|
30
31
|
end
|
|
31
32
|
end
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
# Historiographer will throw an error if a model is saved without a user present,
|
|
7
7
|
# unless you explicitly call save_without_history.
|
|
8
8
|
#
|
|
9
|
-
# Historiographer::Silent will not throw an error, and will not
|
|
9
|
+
# Historiographer::Silent will not throw an error, and will not notify the error notifier
|
|
10
10
|
#
|
|
11
11
|
module Historiographer
|
|
12
12
|
module Silent
|
data/spec/examples.txt
CHANGED
|
@@ -1,68 +1,71 @@
|
|
|
1
1
|
example_id | status | run_time |
|
|
2
2
|
------------------------------------------------------------------ | ------ | --------------- |
|
|
3
|
-
./spec/historiographer_spec.rb[1:1:1] | passed | 0.
|
|
4
|
-
./spec/historiographer_spec.rb[1:1:2] | passed | 0.
|
|
5
|
-
./spec/historiographer_spec.rb[1:1:3] | passed | 0.
|
|
6
|
-
./spec/historiographer_spec.rb[1:2:1] | passed | 0.
|
|
7
|
-
./spec/historiographer_spec.rb[1:2:2] | passed | 0.
|
|
8
|
-
./spec/historiographer_spec.rb[1:2:3:1:1] | passed | 0.
|
|
9
|
-
./spec/historiographer_spec.rb[1:2:3:1:2] | passed | 0.
|
|
10
|
-
./spec/historiographer_spec.rb[1:2:3:2:1] | passed | 0.
|
|
11
|
-
./spec/historiographer_spec.rb[1:2:3:2:2] | passed | 0.
|
|
12
|
-
./spec/historiographer_spec.rb[1:2:3:2:3] | passed | 0.
|
|
13
|
-
./spec/historiographer_spec.rb[1:2:3:3:1] | passed | 0.
|
|
14
|
-
./spec/historiographer_spec.rb[1:2:3:3:2] | passed | 0.
|
|
15
|
-
./spec/historiographer_spec.rb[1:2:4:1] | passed | 0.
|
|
16
|
-
./spec/historiographer_spec.rb[1:2:4:2] | passed | 0.
|
|
17
|
-
./spec/historiographer_spec.rb[1:2:4:3] | passed | 0.
|
|
18
|
-
./spec/historiographer_spec.rb[1:2:5:1] | passed | 0.
|
|
19
|
-
./spec/historiographer_spec.rb[1:2:5:2] | passed | 0.
|
|
20
|
-
./spec/historiographer_spec.rb[1:2:5:3] | passed | 0.
|
|
21
|
-
./spec/historiographer_spec.rb[1:2:6]
|
|
22
|
-
./spec/historiographer_spec.rb[1:2:
|
|
23
|
-
./spec/historiographer_spec.rb[1:2:
|
|
24
|
-
./spec/historiographer_spec.rb[1:
|
|
25
|
-
./spec/historiographer_spec.rb[1:
|
|
26
|
-
./spec/historiographer_spec.rb[1:
|
|
27
|
-
./spec/historiographer_spec.rb[1:
|
|
28
|
-
./spec/historiographer_spec.rb[1:
|
|
29
|
-
./spec/historiographer_spec.rb[1:
|
|
30
|
-
./spec/historiographer_spec.rb[1:
|
|
31
|
-
./spec/historiographer_spec.rb[1:
|
|
32
|
-
./spec/historiographer_spec.rb[1:
|
|
33
|
-
./spec/historiographer_spec.rb[1:7:
|
|
34
|
-
./spec/historiographer_spec.rb[1:7:
|
|
35
|
-
./spec/historiographer_spec.rb[1:
|
|
36
|
-
./spec/historiographer_spec.rb[1:
|
|
37
|
-
./spec/historiographer_spec.rb[1:
|
|
38
|
-
./spec/historiographer_spec.rb[1:
|
|
39
|
-
./spec/historiographer_spec.rb[1:
|
|
40
|
-
./spec/historiographer_spec.rb[1:
|
|
41
|
-
./spec/historiographer_spec.rb[1:11:
|
|
42
|
-
./spec/historiographer_spec.rb[1:
|
|
43
|
-
./spec/historiographer_spec.rb[1:
|
|
44
|
-
./spec/historiographer_spec.rb[1:
|
|
45
|
-
./spec/historiographer_spec.rb[1:12:
|
|
46
|
-
./spec/historiographer_spec.rb[1:12:
|
|
47
|
-
./spec/historiographer_spec.rb[1:12:
|
|
48
|
-
./spec/historiographer_spec.rb[1:12:
|
|
49
|
-
./spec/historiographer_spec.rb[1:
|
|
50
|
-
./spec/historiographer_spec.rb[1:
|
|
51
|
-
./spec/historiographer_spec.rb[1:
|
|
52
|
-
./spec/historiographer_spec.rb[1:
|
|
53
|
-
./spec/historiographer_spec.rb[1:14:
|
|
54
|
-
./spec/historiographer_spec.rb[1:
|
|
55
|
-
./spec/historiographer_spec.rb[1:
|
|
56
|
-
./spec/historiographer_spec.rb[1:
|
|
57
|
-
./spec/historiographer_spec.rb[1:
|
|
58
|
-
./spec/historiographer_spec.rb[1:
|
|
59
|
-
./spec/historiographer_spec.rb[1:16:
|
|
60
|
-
./spec/historiographer_spec.rb[1:
|
|
61
|
-
./spec/historiographer_spec.rb[1:
|
|
62
|
-
./spec/historiographer_spec.rb[1:
|
|
63
|
-
./spec/
|
|
64
|
-
./spec/
|
|
65
|
-
./spec/
|
|
3
|
+
./spec/historiographer_spec.rb[1:1:1] | passed | 0.06543 seconds |
|
|
4
|
+
./spec/historiographer_spec.rb[1:1:2] | passed | 0.06509 seconds |
|
|
5
|
+
./spec/historiographer_spec.rb[1:1:3] | passed | 0.07026 seconds |
|
|
6
|
+
./spec/historiographer_spec.rb[1:2:1] | passed | 0.09216 seconds |
|
|
7
|
+
./spec/historiographer_spec.rb[1:2:2] | passed | 0.06054 seconds |
|
|
8
|
+
./spec/historiographer_spec.rb[1:2:3:1:1] | passed | 0.08967 seconds |
|
|
9
|
+
./spec/historiographer_spec.rb[1:2:3:1:2] | passed | 0.07586 seconds |
|
|
10
|
+
./spec/historiographer_spec.rb[1:2:3:2:1] | passed | 0.06628 seconds |
|
|
11
|
+
./spec/historiographer_spec.rb[1:2:3:2:2] | passed | 0.06995 seconds |
|
|
12
|
+
./spec/historiographer_spec.rb[1:2:3:2:3] | passed | 0.0885 seconds |
|
|
13
|
+
./spec/historiographer_spec.rb[1:2:3:3:1] | passed | 0.07021 seconds |
|
|
14
|
+
./spec/historiographer_spec.rb[1:2:3:3:2] | passed | 0.06715 seconds |
|
|
15
|
+
./spec/historiographer_spec.rb[1:2:4:1] | passed | 0.06369 seconds |
|
|
16
|
+
./spec/historiographer_spec.rb[1:2:4:2] | passed | 0.07078 seconds |
|
|
17
|
+
./spec/historiographer_spec.rb[1:2:4:3] | passed | 0.06737 seconds |
|
|
18
|
+
./spec/historiographer_spec.rb[1:2:5:1] | passed | 0.0628 seconds |
|
|
19
|
+
./spec/historiographer_spec.rb[1:2:5:2] | passed | 0.06046 seconds |
|
|
20
|
+
./spec/historiographer_spec.rb[1:2:5:3] | passed | 0.05982 seconds |
|
|
21
|
+
./spec/historiographer_spec.rb[1:2:6:1] | passed | 0.07928 seconds |
|
|
22
|
+
./spec/historiographer_spec.rb[1:2:6:2] | passed | 0.06175 seconds |
|
|
23
|
+
./spec/historiographer_spec.rb[1:2:6:3] | passed | 0.06112 seconds |
|
|
24
|
+
./spec/historiographer_spec.rb[1:2:7] | passed | 0.06096 seconds |
|
|
25
|
+
./spec/historiographer_spec.rb[1:2:8] | passed | 0.06386 seconds |
|
|
26
|
+
./spec/historiographer_spec.rb[1:2:9] | passed | 0.06282 seconds |
|
|
27
|
+
./spec/historiographer_spec.rb[1:3:1] | passed | 0.06151 seconds |
|
|
28
|
+
./spec/historiographer_spec.rb[1:4:1] | passed | 0.06492 seconds |
|
|
29
|
+
./spec/historiographer_spec.rb[1:5:1] | passed | 0.07695 seconds |
|
|
30
|
+
./spec/historiographer_spec.rb[1:5:2] | passed | 0.05892 seconds |
|
|
31
|
+
./spec/historiographer_spec.rb[1:6:1] | passed | 0.06398 seconds |
|
|
32
|
+
./spec/historiographer_spec.rb[1:6:2] | passed | 0.06518 seconds |
|
|
33
|
+
./spec/historiographer_spec.rb[1:7:1] | passed | 0.06113 seconds |
|
|
34
|
+
./spec/historiographer_spec.rb[1:7:2] | passed | 0.06028 seconds |
|
|
35
|
+
./spec/historiographer_spec.rb[1:7:3] | passed | 0.0565 seconds |
|
|
36
|
+
./spec/historiographer_spec.rb[1:7:4] | passed | 0.05933 seconds |
|
|
37
|
+
./spec/historiographer_spec.rb[1:7:5] | passed | 0.08531 seconds |
|
|
38
|
+
./spec/historiographer_spec.rb[1:8:1] | passed | 0.06383 seconds |
|
|
39
|
+
./spec/historiographer_spec.rb[1:9:1] | passed | 0.06035 seconds |
|
|
40
|
+
./spec/historiographer_spec.rb[1:10:1] | passed | 0.05681 seconds |
|
|
41
|
+
./spec/historiographer_spec.rb[1:11:1] | passed | 0.06741 seconds |
|
|
42
|
+
./spec/historiographer_spec.rb[1:11:2] | passed | 0.0955 seconds |
|
|
43
|
+
./spec/historiographer_spec.rb[1:11:3] | passed | 0.06788 seconds |
|
|
44
|
+
./spec/historiographer_spec.rb[1:11:4] | passed | 0.06571 seconds |
|
|
45
|
+
./spec/historiographer_spec.rb[1:12:1] | passed | 0.06781 seconds |
|
|
46
|
+
./spec/historiographer_spec.rb[1:12:2] | passed | 0.09311 seconds |
|
|
47
|
+
./spec/historiographer_spec.rb[1:12:3] | passed | 0.07594 seconds |
|
|
48
|
+
./spec/historiographer_spec.rb[1:12:4] | passed | 0.06983 seconds |
|
|
49
|
+
./spec/historiographer_spec.rb[1:12:5] | passed | 0.06867 seconds |
|
|
50
|
+
./spec/historiographer_spec.rb[1:12:6] | passed | 0.06622 seconds |
|
|
51
|
+
./spec/historiographer_spec.rb[1:12:7] | passed | 0.08491 seconds |
|
|
52
|
+
./spec/historiographer_spec.rb[1:13:1] | passed | 0.12328 seconds |
|
|
53
|
+
./spec/historiographer_spec.rb[1:14:1] | passed | 0.06007 seconds |
|
|
54
|
+
./spec/historiographer_spec.rb[1:14:2] | passed | 0.06149 seconds |
|
|
55
|
+
./spec/historiographer_spec.rb[1:14:3] | passed | 0.05715 seconds |
|
|
56
|
+
./spec/historiographer_spec.rb[1:14:4] | passed | 0.0681 seconds |
|
|
57
|
+
./spec/historiographer_spec.rb[1:15:1] | passed | 0.06421 seconds |
|
|
58
|
+
./spec/historiographer_spec.rb[1:15:2] | passed | 0.06433 seconds |
|
|
59
|
+
./spec/historiographer_spec.rb[1:16:1] | passed | 0.05958 seconds |
|
|
60
|
+
./spec/historiographer_spec.rb[1:16:2] | passed | 0.05852 seconds |
|
|
61
|
+
./spec/historiographer_spec.rb[1:16:3] | passed | 0.05947 seconds |
|
|
62
|
+
./spec/historiographer_spec.rb[1:16:4] | passed | 0.06959 seconds |
|
|
63
|
+
./spec/historiographer_spec.rb[1:17:1:1] | passed | 0.0567 seconds |
|
|
64
|
+
./spec/historiographer_spec.rb[1:17:1:2] | passed | 0.0572 seconds |
|
|
65
|
+
./spec/historiographer_spec.rb[1:17:2:1] | passed | 0.08553 seconds |
|
|
66
|
+
./spec/integration/historiographer_safe_integration_spec.rb[1:1:1] | passed | 0.0937 seconds |
|
|
67
|
+
./spec/integration/historiographer_safe_integration_spec.rb[1:1:2] | passed | 0.0772 seconds |
|
|
68
|
+
./spec/integration/historiographer_safe_integration_spec.rb[1:1:3] | passed | 0.06363 seconds |
|
|
66
69
|
./spec/view_backed_model_spec.rb[1:1:1] | passed | 0.06878 seconds |
|
|
67
70
|
./spec/view_backed_model_spec.rb[1:1:2] | passed | 0.08949 seconds |
|
|
68
71
|
./spec/view_backed_model_spec.rb[1:1:3:1] | passed | 0.11878 seconds |
|
|
@@ -267,14 +267,24 @@ describe Historiographer do
|
|
|
267
267
|
end
|
|
268
268
|
|
|
269
269
|
context 'When Safe mode' do
|
|
270
|
-
|
|
271
|
-
|
|
270
|
+
let(:error_messages) { [] }
|
|
271
|
+
|
|
272
|
+
before do
|
|
273
|
+
Historiographer::Configuration.error_notifier = ->(msg) { error_messages << msg }
|
|
274
|
+
end
|
|
272
275
|
|
|
276
|
+
after do
|
|
277
|
+
Historiographer::Configuration.instance.error_notifier = nil
|
|
278
|
+
end
|
|
279
|
+
|
|
280
|
+
it 'creates history without history_user_id' do
|
|
273
281
|
post = SafePost.create(
|
|
274
282
|
title: 'Post 1',
|
|
275
283
|
body: 'Great post',
|
|
276
284
|
author_id: 1
|
|
277
285
|
)
|
|
286
|
+
expect(error_messages.length).to eq(1)
|
|
287
|
+
expect(error_messages.first).to include('history_user_id must be passed')
|
|
278
288
|
expect_rails_errors(post.errors, {})
|
|
279
289
|
expect(post).to be_persisted
|
|
280
290
|
expect(post.histories.count).to eq 1
|
|
@@ -282,14 +292,13 @@ describe Historiographer do
|
|
|
282
292
|
end
|
|
283
293
|
|
|
284
294
|
it 'creates history with history_user_id' do
|
|
285
|
-
expect(Rollbar).to_not receive(:error)
|
|
286
|
-
|
|
287
295
|
post = SafePost.create(
|
|
288
296
|
title: 'Post 1',
|
|
289
297
|
body: 'Great post',
|
|
290
298
|
author_id: 1,
|
|
291
299
|
history_user_id: user.id
|
|
292
300
|
)
|
|
301
|
+
expect(error_messages).to be_empty
|
|
293
302
|
expect_rails_errors(post.errors, {})
|
|
294
303
|
expect(post).to be_persisted
|
|
295
304
|
expect(post.histories.count).to eq 1
|
|
@@ -310,15 +319,24 @@ describe Historiographer do
|
|
|
310
319
|
end
|
|
311
320
|
|
|
312
321
|
context 'When Silent mode' do
|
|
313
|
-
|
|
314
|
-
|
|
322
|
+
let(:error_messages) { [] }
|
|
323
|
+
|
|
324
|
+
before do
|
|
325
|
+
Historiographer::Configuration.error_notifier = ->(msg) { error_messages << msg }
|
|
326
|
+
end
|
|
327
|
+
|
|
328
|
+
after do
|
|
329
|
+
Historiographer::Configuration.instance.error_notifier = nil
|
|
330
|
+
end
|
|
315
331
|
|
|
332
|
+
it 'creates history without history_user_id' do
|
|
316
333
|
post = SilentPost.create(
|
|
317
334
|
title: 'Post 1',
|
|
318
335
|
body: 'Great post',
|
|
319
336
|
author_id: 1
|
|
320
337
|
)
|
|
321
338
|
|
|
339
|
+
expect(error_messages).to be_empty
|
|
322
340
|
expect_rails_errors(post.errors, {})
|
|
323
341
|
expect(post).to be_persisted
|
|
324
342
|
expect(post.histories.count).to eq 1
|
|
@@ -330,14 +348,13 @@ describe Historiographer do
|
|
|
330
348
|
end
|
|
331
349
|
|
|
332
350
|
it 'creates history with history_user_id' do
|
|
333
|
-
expect(Rollbar).to_not receive(:error)
|
|
334
|
-
|
|
335
351
|
post = SilentPost.create(
|
|
336
352
|
title: 'Post 1',
|
|
337
353
|
body: 'Great post',
|
|
338
354
|
author_id: 1,
|
|
339
355
|
history_user_id: user.id
|
|
340
356
|
)
|
|
357
|
+
expect(error_messages).to be_empty
|
|
341
358
|
expect_rails_errors(post.errors, {})
|
|
342
359
|
expect(post).to be_persisted
|
|
343
360
|
expect(post.histories.count).to eq 1
|
|
@@ -356,6 +373,46 @@ describe Historiographer do
|
|
|
356
373
|
expect(post.histories.count).to eq 0
|
|
357
374
|
end
|
|
358
375
|
end
|
|
376
|
+
|
|
377
|
+
context 'Default error_notifier' do
|
|
378
|
+
it 'calls Rollbar.error when Rollbar is defined' do
|
|
379
|
+
expect(Rollbar).to receive(:error).with('history_user_id must be passed in order to save record with histories! If you are in a context with no history_user_id, explicitly call #save_without_history')
|
|
380
|
+
|
|
381
|
+
SafePost.create(title: 'Post 1', body: 'Great post', author_id: 1)
|
|
382
|
+
end
|
|
383
|
+
|
|
384
|
+
it 'falls back to Rails.logger.error when Rollbar is not defined' do
|
|
385
|
+
notifier = ->(message) {
|
|
386
|
+
if defined?(Rollbar)
|
|
387
|
+
Rollbar.error(message)
|
|
388
|
+
elsif defined?(Rails) && Rails.logger
|
|
389
|
+
Rails.logger.error(message)
|
|
390
|
+
end
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
hide_const('Rollbar')
|
|
394
|
+
logger = double('logger')
|
|
395
|
+
allow(Rails).to receive(:logger).and_return(logger)
|
|
396
|
+
expect(logger).to receive(:error).with('test message')
|
|
397
|
+
|
|
398
|
+
notifier.call('test message')
|
|
399
|
+
end
|
|
400
|
+
|
|
401
|
+
it 'does not raise when neither Rollbar nor Rails.logger is defined' do
|
|
402
|
+
notifier = ->(message) {
|
|
403
|
+
if defined?(Rollbar)
|
|
404
|
+
Rollbar.error(message)
|
|
405
|
+
elsif defined?(Rails) && Rails.logger
|
|
406
|
+
Rails.logger.error(message)
|
|
407
|
+
end
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
hide_const('Rollbar')
|
|
411
|
+
hide_const('Rails')
|
|
412
|
+
|
|
413
|
+
expect { notifier.call('test message') }.to_not raise_error
|
|
414
|
+
end
|
|
415
|
+
end
|
|
359
416
|
it 'can override without history_user_id' do
|
|
360
417
|
expect do
|
|
361
418
|
post = Post.new(
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: historiographer
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 4.
|
|
4
|
+
version: 4.5.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- brettshollenberger
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-02-19 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activerecord
|
|
@@ -73,7 +73,7 @@ dependencies:
|
|
|
73
73
|
- - ">="
|
|
74
74
|
- !ruby/object:Gem::Version
|
|
75
75
|
version: '0'
|
|
76
|
-
type: :
|
|
76
|
+
type: :development
|
|
77
77
|
prerelease: false
|
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
|
79
79
|
requirements:
|