rambulance 3.1.0 → 3.2.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/.github/workflows/tests.yml +3 -3
- data/CHANGELOG.md +12 -4
- data/README.md +3 -3
- data/lib/generators/rambulance/templates/exceptions_app.rb +1 -1
- data/lib/generators/rambulance/templates/rambulance.rb +1 -1
- data/lib/generators/rambulance/templates/views/{unprocessable_entity.html.erb → unprocessable_content.html.erb} +1 -1
- data/lib/rambulance/exceptions_app.rb +11 -1
- data/lib/rambulance/version.rb +1 -1
- data/test/exceptions_app_test.rb +6 -0
- metadata +5 -5
- /data/lib/generators/rambulance/templates/views/{unprocessable_entity.json.jbuilder → unprocessable_content.json.jbuilder} +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d258a488889e8469aee921802e1ec980209878a709e6b7baa7a34111b13164c3
|
4
|
+
data.tar.gz: 3177f6eafb2e69b5744b4bdb73b00ab7a19c2b0b31257527e3aa07d286fa6934
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 58c01d13e0bdf2026c515b79696d72efdddb9cef89847e4a90db6189fe5a516d6786fdb594db3e36dbbaf87f4de44abe39b51fc044f7b08feee4ac052990c407
|
7
|
+
data.tar.gz: d2b980e56e9533a4d0a0ffc95c27aec009b822a307176be0341e08e255961c141120825f0dd25b208ee74fb97be5c8f7c31d7b74fe06c67620982ac4988d6823
|
data/.github/workflows/tests.yml
CHANGED
@@ -115,7 +115,7 @@ jobs:
|
|
115
115
|
env:
|
116
116
|
BUNDLE_GEMFILE: ${{ matrix.gemfile }}
|
117
117
|
steps:
|
118
|
-
- uses: actions/checkout@
|
118
|
+
- uses: actions/checkout@v4
|
119
119
|
- name: Set up Ruby
|
120
120
|
uses: ruby/setup-ruby@v1
|
121
121
|
with:
|
@@ -130,7 +130,7 @@ jobs:
|
|
130
130
|
env:
|
131
131
|
BUNDLE_GEMFILE: gemfiles/rails_edge.gemfile
|
132
132
|
steps:
|
133
|
-
- uses: actions/checkout@
|
133
|
+
- uses: actions/checkout@v4
|
134
134
|
- name: Set up Ruby
|
135
135
|
uses: ruby/setup-ruby@v1
|
136
136
|
with:
|
@@ -153,7 +153,7 @@ jobs:
|
|
153
153
|
env:
|
154
154
|
BUNDLE_GEMFILE: ${{ matrix.gemfile }}
|
155
155
|
steps:
|
156
|
-
- uses: actions/checkout@
|
156
|
+
- uses: actions/checkout@v4
|
157
157
|
- name: Set up Ruby
|
158
158
|
uses: ruby/setup-ruby@v1
|
159
159
|
with:
|
data/CHANGELOG.md
CHANGED
@@ -1,11 +1,19 @@
|
|
1
|
-
## v3.
|
1
|
+
## v3.2.0
|
2
2
|
|
3
|
-
_<sup>
|
3
|
+
_<sup>unreleased</sup>_
|
4
4
|
|
5
5
|
#### New Features
|
6
6
|
|
7
|
-
-
|
8
|
-
|
7
|
+
- Fix the compatibility with Rack (see https://github.com/rack/rack/pull/2137) (#77 @tmaier, #78)
|
8
|
+
#
|
9
|
+
# [v3.1.0](https://github.com/yuki24/rambulance/tree/v3.1.0)
|
10
|
+
|
11
|
+
_<sup>released at 2024-01-04 10:08:11 UTC</sup>_
|
12
|
+
|
13
|
+
#### New Features
|
14
|
+
|
15
|
+
- The test helper is now compatible with Rails Edge (8.0) ([#73](https://github.com/yuki24/rambulance/pull/73), [#75](https://github.com/yuki24/rambulance/pull/75))
|
16
|
+
- Add support for Ruby 3.3 ([#74](https://github.com/yuki24/rambulance/pull/74))
|
9
17
|
|
10
18
|
## [v3.0.0](https://github.com/yuki24/rambulance/tree/v3.0.0)
|
11
19
|
|
data/README.md
CHANGED
@@ -48,7 +48,7 @@ Then do the following:
|
|
48
48
|
```ruby
|
49
49
|
# config/initializers/rambulance.rb
|
50
50
|
config.rescue_responses = {
|
51
|
-
"ActiveRecord::RecordNotUnique" => :
|
51
|
+
"ActiveRecord::RecordNotUnique" => :unprocessable_content,
|
52
52
|
"CanCan::AccessDenied" => :forbidden,
|
53
53
|
"YourCustomException" => :not_found
|
54
54
|
}
|
@@ -123,8 +123,8 @@ Note that testing error pages is not encouraged in Rails as it leads to overuse
|
|
123
123
|
|
124
124
|
## Supported Versions
|
125
125
|
|
126
|
-
* Ruby 2.
|
127
|
-
* Rails 4.2, 5.0, 5.1, 5.2, 6.0, 6.1, 7.0 and edge
|
126
|
+
* Ruby 2.5, 2.6, 2.7, 3.0, 3.1, 3.2, 3.3 and JRuby 9.3, 9.4
|
127
|
+
* Rails 4.2, 5.0, 5.1, 5.2, 6.0, 6.1, 7.0, 7.1 and edge
|
128
128
|
|
129
129
|
Rambulance doesn't work with Rails 3.1 and below since they don't provide a way to use a custom exceptions app.
|
130
130
|
|
@@ -15,7 +15,7 @@ Rambulance.setup do |config|
|
|
15
15
|
# If Rambulance receives an exception that is not listed here, it'll render
|
16
16
|
# the internal server error template and return 500 as http status.
|
17
17
|
config.rescue_responses = {
|
18
|
-
# "ActiveRecord::RecordNotUnique" => :
|
18
|
+
# "ActiveRecord::RecordNotUnique" => :unprocessable_content,
|
19
19
|
# "CanCan::AccessDenied" => :forbidden,
|
20
20
|
# "Pundit::NotAuthorizedError" => :forbidden,
|
21
21
|
# "YourCustomException" => :not_found
|
@@ -38,7 +38,11 @@ module Rambulance
|
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
41
|
-
|
41
|
+
if exception.nil? && status_in_words == :unprocessable_entity
|
42
|
+
[302, { "Location" => "/rambulance/unprocessable_content" }, [""]]
|
43
|
+
else
|
44
|
+
action(status_in_words).call(env)
|
45
|
+
end
|
42
46
|
end
|
43
47
|
|
44
48
|
def self.local_prefixes
|
@@ -53,6 +57,12 @@ module Rambulance
|
|
53
57
|
ACTION
|
54
58
|
end
|
55
59
|
|
60
|
+
def unprocessable_entity
|
61
|
+
unprocessable_content_path = error_path(:unprocessable_content)
|
62
|
+
|
63
|
+
render(template_exists?(unprocessable_content_path) ? unprocessable_content_path : error_path(:internal_server_error))
|
64
|
+
end
|
65
|
+
|
56
66
|
def process(action, *args)
|
57
67
|
if action.to_s.empty?
|
58
68
|
action = request.env["PATH_INFO"][1..-1].to_sym
|
data/lib/rambulance/version.rb
CHANGED
data/test/exceptions_app_test.rb
CHANGED
@@ -6,4 +6,10 @@ class ExeptionsAppTest < ActionDispatch::IntegrationTest
|
|
6
6
|
|
7
7
|
assert_equal 404, response.status
|
8
8
|
end
|
9
|
+
|
10
|
+
test 'returns 302 for unprocessable_entity' do
|
11
|
+
get '/rambulance/unprocessable_entity', headers: { 'Accept' => '*/*' }
|
12
|
+
|
13
|
+
assert_redirected_to '/rambulance/unprocessable_content'
|
14
|
+
end
|
9
15
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rambulance
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yuki Nishijima
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2024-
|
12
|
+
date: 2024-08-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -178,8 +178,8 @@ files:
|
|
178
178
|
- lib/generators/rambulance/templates/views/not_acceptable.text.erb
|
179
179
|
- lib/generators/rambulance/templates/views/not_found.html.erb
|
180
180
|
- lib/generators/rambulance/templates/views/not_found.json.jbuilder
|
181
|
-
- lib/generators/rambulance/templates/views/
|
182
|
-
- lib/generators/rambulance/templates/views/
|
181
|
+
- lib/generators/rambulance/templates/views/unprocessable_content.html.erb
|
182
|
+
- lib/generators/rambulance/templates/views/unprocessable_content.json.jbuilder
|
183
183
|
- lib/rambulance.rb
|
184
184
|
- lib/rambulance/engine.rb
|
185
185
|
- lib/rambulance/exceptions_app.rb
|
@@ -223,7 +223,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
223
223
|
- !ruby/object:Gem::Version
|
224
224
|
version: '0'
|
225
225
|
requirements: []
|
226
|
-
rubygems_version: 3.
|
226
|
+
rubygems_version: 3.5.11
|
227
227
|
signing_key:
|
228
228
|
specification_version: 4
|
229
229
|
summary: Simple and safe way to dynamically generate error pages
|