rambulance 3.1.0 → 3.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 71f3781bf725a20d74a6f2d8d2320672072044e5ecee1aa4e4000739ef15581e
4
- data.tar.gz: e6d8fac7b73d483f4033f15643d5e38d0f9643a21d843318087550979434cfb0
3
+ metadata.gz: 9370918184eb1f9f6429fa18b2ef6f08d845050f98271184abd941679f8cb4cf
4
+ data.tar.gz: 9e0270f66522474c1b2ef50a0685f7133cb9c2985367b836cc4070b9bb92ada0
5
5
  SHA512:
6
- metadata.gz: c9f0f56788587ddc1057df037a3adf384e1ae1edd7613244d174f7c851ca22ddc056f118ea2489c1c5ca86aa20e724eee215457b6b118fe9b31a6ea0936cf532
7
- data.tar.gz: 56c981eb197bb799e4a809c2a1477bfb5b60c5a24ea5a93d8972d3df92c9256552fe4962c016d29419599dd6bf911e48b75005c400d63015d04095d0a41ab89e
6
+ metadata.gz: bd7673e1a6197f39ef3e70786c7334e1933eb02ce6b44095ab8ff0c0dc30d8d04bbef6ec4c351fae7c7ad0e30aef05caf538029210098d41776865521183d97f
7
+ data.tar.gz: 8e8bde197754afddfbda3049f0863fb743c6f99df536c5bba3d803543aed957f89092323a44a8bf6ef185d4d50edc195ba9091e3d938780f8de190d2d0a1a8c3
@@ -115,7 +115,7 @@ jobs:
115
115
  env:
116
116
  BUNDLE_GEMFILE: ${{ matrix.gemfile }}
117
117
  steps:
118
- - uses: actions/checkout@v3
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@v3
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@v3
156
+ - uses: actions/checkout@v4
157
157
  - name: Set up Ruby
158
158
  uses: ruby/setup-ruby@v1
159
159
  with:
data/Appraisals CHANGED
@@ -49,12 +49,16 @@ appraise "rails_71" do
49
49
  gem "railties", "~> 7.1.0"
50
50
  end
51
51
 
52
+ appraise "rails_72" do
53
+ gem "activesupport", "~> 7.2.0"
54
+ gem "actionpack", "~> 7.2.0"
55
+ gem "railties", "~> 7.2.0"
56
+ end
57
+
52
58
  appraise "rails_edge" do
53
59
  git 'https://github.com/rails/rails.git' do
54
60
  gem "activesupport", require: 'active_support'
55
61
  gem "actionpack", require: 'action_pack'
56
62
  gem "railties"
57
63
  end
58
-
59
- gem 'minitest', '~> 5.3.4'
60
64
  end
data/CHANGELOG.md CHANGED
@@ -1,11 +1,39 @@
1
- ## v3.1.0
1
+ ## v3.3.0
2
2
 
3
- _<sup>released at 2024-01-04 10:04:32 UTC</sup>_
3
+ _<sup>Unreleased</sup>_
4
4
 
5
5
  #### New Features
6
6
 
7
- - The test helper is now compatible with Rails Edge (8.0) (#73, #75)
8
- - Add support for Ruby 3.3 (#74)
7
+ - Add support for Rails 7.1 ([<tt>e6d42b51</tt>](https://github.com/yuki24/rambulance/commit/e6d42b514d0bdbc2ea5b1603f85ecc9fa24b819a))
8
+
9
+ ## [v3.2.0](https://github.com/yuki24/rambulance/tree/v3.2.0)
10
+
11
+ _<sup>released at 2024-08-04 03:04:26 UTC</sup>_
12
+
13
+ This release includes a **breaking change**. Please read the details below carefully.
14
+
15
+ #### New Features
16
+
17
+ - Fixed compatibility with Rack (see [rack/rack#2137](https://github.com/rack/rack/pull/2137)) ([#77](https://github.com/yuki24/rambulance/issues/77) [@tmaier](https://github.com/tmaier), [#78](https://github.com/yuki24/rambulance/pull/78))
18
+
19
+ #### Breaking Changes
20
+
21
+ The Rack compatibility fix is related to Rack becoming more compliant with the IANA HTTP Status Code Registry.
22
+ As a result:
23
+
24
+ - `unprocessable_entity` has been renamed to `unprocessable_content`.
25
+ - Rambulance will redirect any request from `unprocessable_entity` to `unprocessable_content` for backward compatibility.
26
+ - Users **must** rename the view file from `app/views/errors/unprocessable_entity.html.erb` to `app/views/errors/unprocessable_content.html.erb`.
27
+ - Users **should** update the hash values in their configurations: Change `unprocessable_entity` to `unprocessable_content` in `config.rescue_responses`/`config.action_dispatch.rescue_responses`
28
+
29
+ ## [v3.1.0](https://github.com/yuki24/rambulance/tree/v3.1.0)
30
+
31
+ _<sup>released at 2024-01-04 10:08:11 UTC</sup>_
32
+
33
+ #### New Features
34
+
35
+ - 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))
36
+ - Add support for Ruby 3.3 ([#74](https://github.com/yuki24/rambulance/pull/74))
9
37
 
10
38
  ## [v3.0.0](https://github.com/yuki24/rambulance/tree/v3.0.0)
11
39
 
data/Gemfile CHANGED
@@ -2,3 +2,4 @@ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in rambulance.gemspec
4
4
  gemspec
5
+ gem 'minitest', '< 5.25.0'
data/README.md CHANGED
@@ -48,12 +48,21 @@ Then do the following:
48
48
  ```ruby
49
49
  # config/initializers/rambulance.rb
50
50
  config.rescue_responses = {
51
- "ActiveRecord::RecordNotUnique" => :unprocessable_entity,
51
+ "ActiveRecord::RecordNotUnique" => :unprocessable_content,
52
52
  "CanCan::AccessDenied" => :forbidden,
53
53
  "YourCustomException" => :not_found
54
54
  }
55
55
  ```
56
56
 
57
+ ## Special case `unprocessable_entity`/`unprocessable_content` (HTTP Status 422)
58
+
59
+ Rack renamed `unprocessable_entity` to `unprocessable_content`.
60
+
61
+ Rambulance supports both, but defaults to `unprocessable_content` with version 3.2.0 and later.
62
+ `unprocessable_entity` is supported with a redirect to `unprocessable_content`.
63
+
64
+ This means the view file is called `app/views/errors/unprocessable_content.html.erb`, not `app/views/errors/unprocessable_entity.html.erb`.
65
+
57
66
  ## Local Development
58
67
 
59
68
  ### Open `localhost:3000/rambulance/***` in Your Browser
@@ -123,8 +132,8 @@ Note that testing error pages is not encouraged in Rails as it leads to overuse
123
132
 
124
133
  ## Supported Versions
125
134
 
126
- * Ruby 2.3, 2,4, 2,5, 2.6, 2.7, 3.0, 3.1, and JRuby 9.3
127
- * Rails 4.2, 5.0, 5.1, 5.2, 6.0, 6.1, 7.0 and edge
135
+ * Ruby 2.5, 2.6, 2.7, 3.0, 3.1, 3.2, 3.3 and JRuby 9.3, 9.4
136
+ * Rails 4.2, 5.0, 5.1, 5.2, 6.0, 6.1, 7.0, 7.1 and edge
128
137
 
129
138
  Rambulance doesn't work with Rails 3.1 and below since they don't provide a way to use a custom exceptions app.
130
139
 
@@ -2,9 +2,9 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
+ gem "minitest", "~> 5.3.4"
5
6
  gem "activesupport", "~> 4.2.0"
6
7
  gem "actionpack", "~> 4.2.0"
7
8
  gem "railties", "~> 4.2.0"
8
- gem "minitest", "~> 5.3.4"
9
9
 
10
10
  gemspec path: "../"
@@ -2,9 +2,9 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
+ gem "minitest", "~> 5.3.4"
5
6
  gem "activesupport", "~> 5.0.0"
6
7
  gem "actionpack", "~> 5.0.0"
7
8
  gem "railties", "~> 5.0.0"
8
- gem "minitest", "~> 5.3.4"
9
9
 
10
10
  gemspec path: "../"
@@ -2,6 +2,7 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
+ gem "minitest", "< 5.25.0"
5
6
  gem "activesupport", "~> 5.1.0"
6
7
  gem "actionpack", "~> 5.1.0"
7
8
  gem "railties", "~> 5.1.0"
@@ -2,6 +2,7 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
+ gem "minitest", "< 5.25.0"
5
6
  gem "activesupport", "~> 5.2.0"
6
7
  gem "actionpack", "~> 5.2.0"
7
8
  gem "railties", "~> 5.2.0"
@@ -2,6 +2,7 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
+ gem "minitest", "< 5.25.0"
5
6
  gem "activesupport", "~> 6.0.0"
6
7
  gem "actionpack", "~> 6.0.0"
7
8
  gem "railties", "~> 6.0.0"
@@ -2,6 +2,7 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
+ gem "minitest", "< 5.25.0"
5
6
  gem "activesupport", "~> 6.1.0"
6
7
  gem "actionpack", "~> 6.1.0"
7
8
  gem "railties", "~> 6.1.0"
@@ -2,6 +2,7 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
+ gem "minitest", "< 5.25.0"
5
6
  gem "activesupport", "~> 7.0.0"
6
7
  gem "actionpack", "~> 7.0.0"
7
8
  gem "railties", "~> 7.0.0"
@@ -2,6 +2,7 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
+ gem "minitest", "< 5.25.0"
5
6
  gem "activesupport", "~> 7.1.0"
6
7
  gem "actionpack", "~> 7.1.0"
7
8
  gem "railties", "~> 7.1.0"
@@ -0,0 +1,10 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "minitest", "< 5.25.0"
6
+ gem "activesupport", "~> 7.2.0"
7
+ gem "actionpack", "~> 7.2.0"
8
+ gem "railties", "~> 7.2.0"
9
+
10
+ gemspec path: "../"
@@ -8,6 +8,6 @@ git "https://github.com/rails/rails.git" do
8
8
  gem "railties"
9
9
  end
10
10
 
11
- gem "minitest", "~> 5.3.4"
11
+ gem "minitest", "< 5.25.0"
12
12
 
13
13
  gemspec path: "../"
@@ -11,6 +11,6 @@ class ExceptionsApp < Rambulance::ExceptionsApp
11
11
  def not_found
12
12
  end
13
13
 
14
- def unprocessable_entity
14
+ def unprocessable_content
15
15
  end
16
16
  end
@@ -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" => :unprocessable_entity,
18
+ # "ActiveRecord::RecordNotUnique" => :unprocessable_content,
19
19
  # "CanCan::AccessDenied" => :forbidden,
20
20
  # "Pundit::NotAuthorizedError" => :forbidden,
21
21
  # "YourCustomException" => :not_found
@@ -49,7 +49,7 @@
49
49
  }
50
50
  </style>
51
51
 
52
- <!-- This file lives in app/views/errors/unprocessable_entity.html.erb -->
52
+ <!-- This file lives in app/views/errors/unprocessable_content.html.erb -->
53
53
  <div class="dialog">
54
54
  <div>
55
55
  <h1>The change you wanted was rejected.</h1>
@@ -38,7 +38,11 @@ module Rambulance
38
38
  end
39
39
  end
40
40
 
41
- action(status_in_words).call(env)
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
@@ -1,3 +1,3 @@
1
1
  module Rambulance
2
- VERSION = "3.1.0"
2
+ VERSION = "3.3.0"
3
3
  end
@@ -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.1.0
4
+ version: 3.3.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-01-04 00:00:00.000000000 Z
12
+ date: 2024-08-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -164,6 +164,7 @@ files:
164
164
  - gemfiles/rails_61.gemfile
165
165
  - gemfiles/rails_70.gemfile
166
166
  - gemfiles/rails_71.gemfile
167
+ - gemfiles/rails_72.gemfile
167
168
  - gemfiles/rails_edge.gemfile
168
169
  - lib/generators/rambulance/exceptions_app_generator.rb
169
170
  - lib/generators/rambulance/install_generator.rb
@@ -178,8 +179,8 @@ files:
178
179
  - lib/generators/rambulance/templates/views/not_acceptable.text.erb
179
180
  - lib/generators/rambulance/templates/views/not_found.html.erb
180
181
  - lib/generators/rambulance/templates/views/not_found.json.jbuilder
181
- - lib/generators/rambulance/templates/views/unprocessable_entity.html.erb
182
- - lib/generators/rambulance/templates/views/unprocessable_entity.json.jbuilder
182
+ - lib/generators/rambulance/templates/views/unprocessable_content.html.erb
183
+ - lib/generators/rambulance/templates/views/unprocessable_content.json.jbuilder
183
184
  - lib/rambulance.rb
184
185
  - lib/rambulance/engine.rb
185
186
  - lib/rambulance/exceptions_app.rb
@@ -223,7 +224,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
223
224
  - !ruby/object:Gem::Version
224
225
  version: '0'
225
226
  requirements: []
226
- rubygems_version: 3.4.22
227
+ rubygems_version: 3.5.11
227
228
  signing_key:
228
229
  specification_version: 4
229
230
  summary: Simple and safe way to dynamically generate error pages