factory_bot_instrumentation 0.5.1 → 0.6.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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ff6458a1179520c115511b80ad9bdcb335fb652a04c647a12e7515a678440942
|
4
|
+
data.tar.gz: dce3493555ed93a948fea4b4d79b0dbb8c9d1984439706d4b0d1b400a75748fb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 24a2ffa2f0c9092222f13826ec2e5232db505fcaddb8df33ae0eed39494ac8a36248f3c3cd39582fc88b6447401dbdd7850a08b6ed045091321f543d67eacc89
|
7
|
+
data.tar.gz: ab32dc405102f93ea3b6dfc409c292600b8bfdac8839bc4cabe949fe8168729d8f8a6b435798c3703bfcd1eba9853870344e2875f9ebef77d1182bea81c71276
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -316,6 +316,18 @@ FactoryBot::Instrumentation.configure do |conf|
|
|
316
316
|
controller.render plain: entity.to_json,
|
317
317
|
content_type: 'application/json'
|
318
318
|
end
|
319
|
+
# By default we assemble a JSON response on errors which may be
|
320
|
+
# helpful for debugging, but you can configure your own logic here
|
321
|
+
conf.render_error = proc do |controller, error|
|
322
|
+
app_name = FactoryBot::Instrumentation.configuration.application_name
|
323
|
+
controller.render status: :internal_server_error,
|
324
|
+
content_type: 'application/json',
|
325
|
+
plain: {
|
326
|
+
application: app_name,
|
327
|
+
error: error.message,
|
328
|
+
backtrace: error.backtrace.join("\n")
|
329
|
+
}.to_json
|
330
|
+
end
|
319
331
|
# By default we do not perform any custom +before_action+ filters on the
|
320
332
|
# instrumentation controllers, with this option you can implement your
|
321
333
|
# custom logic like authentication
|
@@ -43,9 +43,8 @@ module FactoryBot::Instrumentation
|
|
43
43
|
# Render the resulting entity with the configured rendering block
|
44
44
|
FactoryBot::Instrumentation.configuration.render_entity.call(self, entity)
|
45
45
|
rescue StandardError => err
|
46
|
-
#
|
47
|
-
|
48
|
-
raise err
|
46
|
+
# Handle any error gracefully with the configured error handler
|
47
|
+
FactoryBot::Instrumentation.configuration.render_error.call(self, err)
|
49
48
|
end
|
50
49
|
|
51
50
|
private
|
@@ -25,6 +25,21 @@ module FactoryBot
|
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
|
+
# By default we assemble a JSON response on errors which may be
|
29
|
+
# helpful for debugging, but you can configure your own logic here
|
30
|
+
config_accessor(:render_error) do
|
31
|
+
proc do |controller, error|
|
32
|
+
app_name = FactoryBot::Instrumentation.configuration.application_name
|
33
|
+
controller.render status: :internal_server_error,
|
34
|
+
content_type: 'application/json',
|
35
|
+
plain: {
|
36
|
+
application: app_name,
|
37
|
+
error: error.message,
|
38
|
+
backtrace: error.backtrace.join("\n")
|
39
|
+
}.to_json
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
28
43
|
# By default we do not perform any custom +before_action+ filters on the
|
29
44
|
# instrumentation controllers, with this option you can implement your
|
30
45
|
# custom logic like authentication
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: factory_bot_instrumentation
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hermann Mayer
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-09-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -188,7 +188,7 @@ files:
|
|
188
188
|
homepage: https://github.com/hausgold/factory_bot_instrumentation
|
189
189
|
licenses: []
|
190
190
|
metadata: {}
|
191
|
-
post_install_message:
|
191
|
+
post_install_message:
|
192
192
|
rdoc_options: []
|
193
193
|
require_paths:
|
194
194
|
- lib
|
@@ -203,8 +203,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
203
203
|
- !ruby/object:Gem::Version
|
204
204
|
version: '0'
|
205
205
|
requirements: []
|
206
|
-
rubygems_version: 3.1.
|
207
|
-
signing_key:
|
206
|
+
rubygems_version: 3.1.4
|
207
|
+
signing_key:
|
208
208
|
specification_version: 4
|
209
209
|
summary: Allow your testers to generate test data on demand
|
210
210
|
test_files: []
|