rescue_registry 0.2.0 → 0.2.1
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/CHANGELOG.md +4 -0
- data/lib/rescue_registry.rb +1 -0
- data/lib/rescue_registry/rails_test_helpers.rb +42 -0
- data/lib/rescue_registry/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4da895627d12dfeacc18cfc33b78f12ba7e2cfd0c1731aa7381e6514cea7e060
|
4
|
+
data.tar.gz: '0782f17a88a32cc3c67273671b3863d2bb54dc4d18e05df1a3c490562cdd798e'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 20c12e26d6cc417581612e50375a0a8e0de1197ef68d1c28cd96a25392384d72c597582ab72f2e5a62eec3f3fffb223d899552c1b84d1c20f7f526700916877c
|
7
|
+
data.tar.gz: e74c56f15650b175ed028720c4bec65aae5ef39b71bfd668baef3a83d996bc927b60f9257d6bb14723ac2b4f11c489b0bf9cef047b494092d55e8e6bf24573a7
|
data/CHANGELOG.md
CHANGED
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
7
7
|
|
8
8
|
---
|
9
9
|
|
10
|
+
## [0.2.1] - 2019-05-22
|
11
|
+
### Added
|
12
|
+
- RescueRegistry::RailsTestingHelpers provides some helpers for easier testing in Rails applications.
|
13
|
+
|
10
14
|
## [0.2.0] - 2019-05-21
|
11
15
|
### Added
|
12
16
|
- Support for non-Rails applications.
|
data/lib/rescue_registry.rb
CHANGED
@@ -9,6 +9,7 @@ module RescueRegistry
|
|
9
9
|
autoload :ExceptionsApp, "rescue_registry/exceptions_app"
|
10
10
|
autoload :ExceptionHandler, "rescue_registry/exception_handler"
|
11
11
|
autoload :RailsExceptionHandler, "rescue_registry/exception_handler"
|
12
|
+
autoload :RailsTestHelpers, "rescue_registry/rails_test_helpers"
|
12
13
|
autoload :Registry, "rescue_registry/registry"
|
13
14
|
autoload :ResetContext, "rescue_registry/reset_context"
|
14
15
|
autoload :ShowExceptions, "rescue_registry/show_exceptions"
|
@@ -0,0 +1,42 @@
|
|
1
|
+
module RescueRegistry
|
2
|
+
# Helpers to improve the ease of testing error handling in Rails tests.
|
3
|
+
# These are not actually specific to RescueRegistry, but will certainly be useful for it.
|
4
|
+
module RailsTestHelpers
|
5
|
+
def handle_request_exceptions(handle = true, &block)
|
6
|
+
set_action_dispatch_property(:show_exceptions, handle, &block)
|
7
|
+
end
|
8
|
+
|
9
|
+
def handle_request_exceptions?
|
10
|
+
Rails.application.config.action_dispatch.show_exceptions
|
11
|
+
end
|
12
|
+
|
13
|
+
def show_detailed_exceptions(show = true, &block)
|
14
|
+
set_action_dispatch_property(:show_detailed_exceptions, show, &block)
|
15
|
+
end
|
16
|
+
|
17
|
+
def show_detailed_exceptions?
|
18
|
+
Rails.application.config.action_dispatch.show_detailed_exceptions
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
def set_action_dispatch_property(key, value)
|
24
|
+
if block_given?
|
25
|
+
original_value = Rails.application.config.action_dispatch.send(key)
|
26
|
+
end
|
27
|
+
|
28
|
+
Rails.application.config.action_dispatch.send("#{key}=", value)
|
29
|
+
# Also set this since it may have been cached
|
30
|
+
Rails.application.env_config["action_dispatch.#{key}"] = value
|
31
|
+
|
32
|
+
if block_given?
|
33
|
+
begin
|
34
|
+
yield
|
35
|
+
ensure
|
36
|
+
Rails.application.env_config["action_dispatch.#{key}"] = original_value
|
37
|
+
Rails.application.config.action_dispatch.send("#{key}=", original_value)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rescue_registry
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Wagenet
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-05-
|
11
|
+
date: 2019-05-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -100,6 +100,7 @@ files:
|
|
100
100
|
- lib/rescue_registry/controller.rb
|
101
101
|
- lib/rescue_registry/exception_handler.rb
|
102
102
|
- lib/rescue_registry/exceptions_app.rb
|
103
|
+
- lib/rescue_registry/rails_test_helpers.rb
|
103
104
|
- lib/rescue_registry/railtie.rb
|
104
105
|
- lib/rescue_registry/registry.rb
|
105
106
|
- lib/rescue_registry/reset_context.rb
|