rambulance 2.3.0 → 3.1.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 +24 -16
- data/Appraisals +6 -0
- data/CHANGELOG.md +33 -2
- data/README.md +1 -1
- data/gemfiles/rails_71.gemfile +9 -0
- data/lib/rambulance/exceptions_app.rb +10 -6
- data/lib/rambulance/test_helper.rb +6 -2
- data/lib/rambulance/version.rb +1 -1
- data/test/exceptions_app_test.rb +0 -1
- data/test/fake_app/rails_app.rb +1 -0
- data/test/requests/error_json_test.rb +20 -14
- metadata +4 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 71f3781bf725a20d74a6f2d8d2320672072044e5ecee1aa4e4000739ef15581e
|
|
4
|
+
data.tar.gz: e6d8fac7b73d483f4033f15643d5e38d0f9643a21d843318087550979434cfb0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c9f0f56788587ddc1057df037a3adf384e1ae1edd7613244d174f7c851ca22ddc056f118ea2489c1c5ca86aa20e724eee215457b6b118fe9b31a6ea0936cf532
|
|
7
|
+
data.tar.gz: 56c981eb197bb799e4a809c2a1477bfb5b60c5a24ea5a93d8972d3df92c9256552fe4962c016d29419599dd6bf911e48b75005c400d63015d04095d0a41ab89e
|
data/.github/workflows/tests.yml
CHANGED
|
@@ -8,17 +8,17 @@ jobs:
|
|
|
8
8
|
strategy:
|
|
9
9
|
matrix:
|
|
10
10
|
ruby_version:
|
|
11
|
+
- '3.3'
|
|
11
12
|
- '3.2'
|
|
12
13
|
- '3.1'
|
|
13
14
|
- '3.0'
|
|
14
15
|
- '2.7'
|
|
15
16
|
- '2.6'
|
|
16
17
|
- '2.5'
|
|
17
|
-
- '2.4'
|
|
18
|
-
- '2.3'
|
|
19
18
|
- 'jruby-9.3'
|
|
20
19
|
- 'jruby-9.4'
|
|
21
20
|
gemfile:
|
|
21
|
+
- gemfiles/rails_71.gemfile
|
|
22
22
|
- gemfiles/rails_70.gemfile
|
|
23
23
|
- gemfiles/rails_61.gemfile
|
|
24
24
|
- gemfiles/rails_60.gemfile
|
|
@@ -27,6 +27,18 @@ jobs:
|
|
|
27
27
|
- gemfiles/rails_50.gemfile
|
|
28
28
|
- gemfiles/rails_42.gemfile
|
|
29
29
|
exclude:
|
|
30
|
+
- ruby_version: '3.3'
|
|
31
|
+
gemfile: gemfiles/rails_61.gemfile
|
|
32
|
+
- ruby_version: '3.3'
|
|
33
|
+
gemfile: gemfiles/rails_60.gemfile
|
|
34
|
+
- ruby_version: '3.3'
|
|
35
|
+
gemfile: gemfiles/rails_52.gemfile
|
|
36
|
+
- ruby_version: '3.3'
|
|
37
|
+
gemfile: gemfiles/rails_51.gemfile
|
|
38
|
+
- ruby_version: '3.3'
|
|
39
|
+
gemfile: gemfiles/rails_50.gemfile
|
|
40
|
+
- ruby_version: '3.3'
|
|
41
|
+
gemfile: gemfiles/rails_42.gemfile
|
|
30
42
|
- ruby_version: '3.2'
|
|
31
43
|
gemfile: gemfiles/rails_61.gemfile
|
|
32
44
|
- ruby_version: '3.2'
|
|
@@ -57,6 +69,8 @@ jobs:
|
|
|
57
69
|
gemfile: gemfiles/rails_50.gemfile
|
|
58
70
|
- ruby_version: '3.0'
|
|
59
71
|
gemfile: gemfiles/rails_42.gemfile
|
|
72
|
+
- ruby_version: '2.7'
|
|
73
|
+
gemfile: gemfiles/rails_71.gemfile
|
|
60
74
|
- ruby_version: '2.7'
|
|
61
75
|
gemfile: gemfiles/rails_70.gemfile
|
|
62
76
|
- ruby_version: '2.7'
|
|
@@ -67,24 +81,18 @@ jobs:
|
|
|
67
81
|
gemfile: gemfiles/rails_50.gemfile
|
|
68
82
|
- ruby_version: '2.7'
|
|
69
83
|
gemfile: gemfiles/rails_42.gemfile
|
|
84
|
+
- ruby_version: '2.6'
|
|
85
|
+
gemfile: gemfiles/rails_71.gemfile
|
|
70
86
|
- ruby_version: '2.6'
|
|
71
87
|
gemfile: gemfiles/rails_70.gemfile
|
|
72
88
|
- ruby_version: '2.6'
|
|
73
89
|
gemfile: gemfiles/rails_42.gemfile
|
|
90
|
+
- ruby_version: '2.5'
|
|
91
|
+
gemfile: gemfiles/rails_71.gemfile
|
|
74
92
|
- ruby_version: '2.5'
|
|
75
93
|
gemfile: gemfiles/rails_70.gemfile
|
|
76
|
-
- ruby_version: '
|
|
77
|
-
gemfile: gemfiles/
|
|
78
|
-
- ruby_version: '2.4'
|
|
79
|
-
gemfile: gemfiles/rails_61.gemfile
|
|
80
|
-
- ruby_version: '2.4'
|
|
81
|
-
gemfile: gemfiles/rails_60.gemfile
|
|
82
|
-
- ruby_version: '2.3'
|
|
83
|
-
gemfile: gemfiles/rails_70.gemfile
|
|
84
|
-
- ruby_version: '2.3'
|
|
85
|
-
gemfile: gemfiles/rails_61.gemfile
|
|
86
|
-
- ruby_version: '2.3'
|
|
87
|
-
gemfile: gemfiles/rails_60.gemfile
|
|
94
|
+
- ruby_version: 'jruby-9.3'
|
|
95
|
+
gemfile: gemfiles/rails_71.gemfile
|
|
88
96
|
- ruby_version: 'jruby-9.3'
|
|
89
97
|
gemfile: gemfiles/rails_70.gemfile
|
|
90
98
|
- ruby_version: 'jruby-9.3'
|
|
@@ -126,7 +134,7 @@ jobs:
|
|
|
126
134
|
- name: Set up Ruby
|
|
127
135
|
uses: ruby/setup-ruby@v1
|
|
128
136
|
with:
|
|
129
|
-
ruby-version: 3.
|
|
137
|
+
ruby-version: 3.3
|
|
130
138
|
bundler-cache: true
|
|
131
139
|
- run: bundle exec rake
|
|
132
140
|
|
|
@@ -140,7 +148,7 @@ jobs:
|
|
|
140
148
|
- 'jruby-head'
|
|
141
149
|
gemfile:
|
|
142
150
|
- gemfiles/rails_edge.gemfile
|
|
143
|
-
- gemfiles/
|
|
151
|
+
- gemfiles/rails_71.gemfile
|
|
144
152
|
runs-on: ubuntu-22.04
|
|
145
153
|
env:
|
|
146
154
|
BUNDLE_GEMFILE: ${{ matrix.gemfile }}
|
data/Appraisals
CHANGED
|
@@ -43,6 +43,12 @@ appraise "rails_70" do
|
|
|
43
43
|
gem "railties", "~> 7.0.0"
|
|
44
44
|
end
|
|
45
45
|
|
|
46
|
+
appraise "rails_71" do
|
|
47
|
+
gem "activesupport", "~> 7.1.0"
|
|
48
|
+
gem "actionpack", "~> 7.1.0"
|
|
49
|
+
gem "railties", "~> 7.1.0"
|
|
50
|
+
end
|
|
51
|
+
|
|
46
52
|
appraise "rails_edge" do
|
|
47
53
|
git 'https://github.com/rails/rails.git' do
|
|
48
54
|
gem "activesupport", require: 'active_support'
|
data/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,37 @@
|
|
|
1
|
-
##
|
|
1
|
+
## v3.1.0
|
|
2
2
|
|
|
3
|
-
_<sup>released at
|
|
3
|
+
_<sup>released at 2024-01-04 10:04:32 UTC</sup>_
|
|
4
|
+
|
|
5
|
+
#### New Features
|
|
6
|
+
|
|
7
|
+
- The test helper is now compatible with Rails Edge (8.0) (#73, #75)
|
|
8
|
+
- Add support for Ruby 3.3 (#74)
|
|
9
|
+
|
|
10
|
+
## [v3.0.0](https://github.com/yuki24/rambulance/tree/v3.0.0)
|
|
11
|
+
|
|
12
|
+
_<sup>released at 2023-09-22 14:47:24 UTC</sup>_
|
|
13
|
+
|
|
14
|
+
#### New Features
|
|
15
|
+
|
|
16
|
+
- Add support for Rails 7.1 ([<tt>be6f129</tt>](https://github.com/yuki24/rambulance/commit/be6f129dd4c1d190e90a3036f7f1099028ef4a1e))
|
|
17
|
+
|
|
18
|
+
#### Breaking Changes
|
|
19
|
+
|
|
20
|
+
- Drop support for Ruby 2.3 and 2.4 ([<tt>c0d3439</tt>](https://github.com/yuki24/rambulance/commit/c0d3439d64552a88cb934d57bc57d2c06ff593c9))
|
|
21
|
+
|
|
22
|
+
## [v2.3.0](https://github.com/yuki24/rambulance/tree/v2.3.0)
|
|
23
|
+
|
|
24
|
+
_<sup>released at 2023-01-05 05:33:36 UTC</sup>_
|
|
25
|
+
|
|
26
|
+
#### New Features
|
|
27
|
+
|
|
28
|
+
- Ruby 3.2 is now officially supported.
|
|
29
|
+
|
|
30
|
+
## [v2.2.0](https://github.com/yuki24/rambulance/tree/v2.2.0)
|
|
31
|
+
|
|
32
|
+
_<sup>released at 2022-02-13 07:56:32 UTC</sup>_
|
|
33
|
+
|
|
34
|
+
#### Features
|
|
4
35
|
|
|
5
36
|
- Add support for Ruby 3.1, Rails 7.0 and JRuby 9.3.3.0
|
|
6
37
|
|
data/README.md
CHANGED
|
@@ -83,7 +83,7 @@ If you want to do some more things in a exceptions app, you can also write your
|
|
|
83
83
|
$ rails g rambulance:exceptions_app
|
|
84
84
|
```
|
|
85
85
|
|
|
86
|
-
It will generate your own custom exceptions app. You can use
|
|
86
|
+
It will generate your own custom exceptions app. You can use most techniques you want to use in controllers like `before_filter` and rendering views since it's a grandchild of `ActionController::Base`! However there are still some restrictions, e.g. setting a flash notice works when rendering directly but not when redirecting because the ActionDispatch::Flash middleware is never hit.
|
|
87
87
|
|
|
88
88
|
**Heavily customizing the exceptions app is strongly discouraged as there would be no guard against bugs that occur in the exceptions app.**
|
|
89
89
|
|
|
@@ -11,12 +11,12 @@ module Rambulance
|
|
|
11
11
|
|
|
12
12
|
BAD_REQUEST_ERRORS = [
|
|
13
13
|
ActionController::BadRequest,
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
# Rails >= 7.1.0
|
|
15
|
+
defined?(ActionDispatch::Http::MimeNegotiation::InvalidType) ? ActionDispatch::Http::MimeNegotiation::InvalidType : nil,
|
|
16
|
+
# Rails >= 5.2.0
|
|
17
|
+
defined?(ActionDispatch::Http::Parameters::ParseError) ? ActionDispatch::Http::Parameters::ParseError : nil,
|
|
18
|
+
# Rails < 5.2.0
|
|
19
|
+
defined?(ActionDispatch::ParamsParser::ParseError) ? ActionDispatch::ParamsParser::ParseError : nil
|
|
20
20
|
].compact.freeze
|
|
21
21
|
|
|
22
22
|
class ExceptionsApp < ActionController::Base
|
|
@@ -89,6 +89,10 @@ module Rambulance
|
|
|
89
89
|
request.env["MALFORMED_HTTP_ACCEPT"], request.env["HTTP_ACCEPT"] = request.env["HTTP_ACCEPT"], "*/*"
|
|
90
90
|
end
|
|
91
91
|
|
|
92
|
+
if defined?(Rack::RACK_REQUEST_FORM_ERROR) && request.env.include?(Rack::RACK_REQUEST_FORM_ERROR)
|
|
93
|
+
request.env.delete(Rack::RACK_REQUEST_FORM_ERROR)
|
|
94
|
+
end
|
|
95
|
+
|
|
92
96
|
# The #formats method needs to be called after the sanitization above.
|
|
93
97
|
request.formats << Mime::Type.lookup('text/plain')
|
|
94
98
|
|
|
@@ -28,7 +28,12 @@ module Rambulance #:nodoc:
|
|
|
28
28
|
org_show_exceptions = Rails.application.env_config['action_dispatch.show_exceptions']
|
|
29
29
|
|
|
30
30
|
Rails.application.env_config['action_dispatch.show_detailed_exceptions'] = !enabled
|
|
31
|
-
|
|
31
|
+
|
|
32
|
+
if ActionDispatch::ExceptionWrapper.instance_methods.include?(:show?)
|
|
33
|
+
Rails.application.env_config['action_dispatch.show_exceptions'] = enabled ? :all : :none
|
|
34
|
+
else
|
|
35
|
+
Rails.application.env_config['action_dispatch.show_exceptions'] = enabled
|
|
36
|
+
end
|
|
32
37
|
|
|
33
38
|
yield
|
|
34
39
|
ensure
|
|
@@ -37,4 +42,3 @@ module Rambulance #:nodoc:
|
|
|
37
42
|
end
|
|
38
43
|
end
|
|
39
44
|
end
|
|
40
|
-
|
data/lib/rambulance/version.rb
CHANGED
data/test/exceptions_app_test.rb
CHANGED
data/test/fake_app/rails_app.rb
CHANGED
|
@@ -4,6 +4,7 @@ require 'jbuilder'
|
|
|
4
4
|
class TestApp < Rails::Application
|
|
5
5
|
config.secret_token = '964ab2f0fbbb68bc36f3cc487ca296bb8555fac50627924024c245a1599e5265'
|
|
6
6
|
config.session_store :cookie_store, :key => '_myapp_session'
|
|
7
|
+
config.active_support.cache_format_version = 7.1 if Rails::VERSION::STRING >= "7.1"
|
|
7
8
|
config.active_support.deprecation = :log
|
|
8
9
|
config.eager_load = false
|
|
9
10
|
config.root = File.dirname(__FILE__)
|
|
@@ -2,28 +2,28 @@ require 'test_helper'
|
|
|
2
2
|
|
|
3
3
|
class ErrorJsonTest < ActionDispatch::IntegrationTest
|
|
4
4
|
test 'returns the 422 json for ActionController:InvalidAuthenticityToken but without its template' do
|
|
5
|
-
|
|
5
|
+
get_json '/users/new'
|
|
6
6
|
|
|
7
7
|
assert_equal 422, response.status
|
|
8
8
|
assert_equal "Something went wrong", json_response['message']
|
|
9
9
|
end
|
|
10
10
|
|
|
11
11
|
test 'returns the 500 json for RuntimeError' do
|
|
12
|
-
|
|
12
|
+
get_json '/users/1.json'
|
|
13
13
|
|
|
14
14
|
assert_equal 500, response.status
|
|
15
15
|
assert_equal "Something went wrong", json_response['message']
|
|
16
16
|
end
|
|
17
17
|
|
|
18
18
|
test 'returns the 404 json for CustomException' do
|
|
19
|
-
|
|
19
|
+
get_json '/users.json'
|
|
20
20
|
|
|
21
21
|
assert_equal 404, response.status
|
|
22
22
|
assert_equal "Page not found", json_response['message']
|
|
23
23
|
end
|
|
24
24
|
|
|
25
25
|
test 'returns the 404 json for ActinoController::RoutingError' do
|
|
26
|
-
|
|
26
|
+
get_json '/doesnt_exist.json'
|
|
27
27
|
|
|
28
28
|
assert_equal 404, response.status
|
|
29
29
|
assert_equal "Page not found", json_response['message']
|
|
@@ -92,21 +92,27 @@ class ErrorJsonTest < ActionDispatch::IntegrationTest
|
|
|
92
92
|
private
|
|
93
93
|
|
|
94
94
|
def without_layouts
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
95
|
+
if Rails::VERSION::STRING >= '7.1.0'
|
|
96
|
+
yield
|
|
97
|
+
else
|
|
98
|
+
begin
|
|
99
|
+
`mv test/fake_app/app/views/layouts/application.html.erb .`
|
|
100
|
+
`mv test/fake_app/app/views/layouts/error.html.erb .`
|
|
101
|
+
|
|
102
|
+
yield
|
|
103
|
+
ensure
|
|
104
|
+
`mv application.html.erb test/fake_app/app/views/layouts/`
|
|
105
|
+
`mv error.html.erb test/fake_app/app/views/layouts/`
|
|
106
|
+
end
|
|
107
|
+
end
|
|
102
108
|
end
|
|
103
109
|
|
|
104
|
-
def
|
|
110
|
+
def get_json(path, params: {}, headers: {})
|
|
105
111
|
without_layouts do
|
|
106
112
|
if Rails::VERSION::STRING >= '5.1.0'
|
|
107
|
-
|
|
113
|
+
get path, params: params, headers: { "CONTENT_TYPE" => "application/json", "HTTP_ACCEPT" => "application/json" }.merge(headers)
|
|
108
114
|
else
|
|
109
|
-
|
|
115
|
+
get path, params, { "CONTENT_TYPE" => "application/json", "HTTP_ACCEPT" => "application/json" }.merge(headers)
|
|
110
116
|
end
|
|
111
117
|
end
|
|
112
118
|
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:
|
|
4
|
+
version: 3.1.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:
|
|
12
|
+
date: 2024-01-04 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: activesupport
|
|
@@ -163,6 +163,7 @@ files:
|
|
|
163
163
|
- gemfiles/rails_60.gemfile
|
|
164
164
|
- gemfiles/rails_61.gemfile
|
|
165
165
|
- gemfiles/rails_70.gemfile
|
|
166
|
+
- gemfiles/rails_71.gemfile
|
|
166
167
|
- gemfiles/rails_edge.gemfile
|
|
167
168
|
- lib/generators/rambulance/exceptions_app_generator.rb
|
|
168
169
|
- lib/generators/rambulance/install_generator.rb
|
|
@@ -222,7 +223,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
222
223
|
- !ruby/object:Gem::Version
|
|
223
224
|
version: '0'
|
|
224
225
|
requirements: []
|
|
225
|
-
rubygems_version: 3.
|
|
226
|
+
rubygems_version: 3.4.22
|
|
226
227
|
signing_key:
|
|
227
228
|
specification_version: 4
|
|
228
229
|
summary: Simple and safe way to dynamically generate error pages
|