You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
require'spec_helper'describeGrape::APIdosubjectdoClass.new(Grape::API)doformat:jsonrescue_from:alldo |e|
rack_response({message: e.message},400)endhelpersdodeferror!(message,status,headers)raise'this should never be called'endendrescue_fromGrape::Exceptions::MethodNotAlloweddo |e|
error!e.message,e.status,e.headersendpostdo{ok: true}endendenddefappsubjectendit'201 on post'dopost'/'expect(last_response.status).toeq201endit'405s on get'doget'/'expect(last_response.status).toeq405endend
In Grape 0.16.2 this passes.
In Grape 0.16.3 this fails with
Grape::API
201 on post
405s on get (FAILED - 1)
Failures:
1) Grape::API 405s on get
Failure/Error: raise 'this should never be called'
RuntimeError:
this should never be called
# ./spec/grape/integration/error_in_middleware_spec.rb:12:in `error!'
# ./spec/grape/integration/error_in_middleware_spec.rb:16:in `block (4 levels) in <top (required)>'
# ./lib/grape/middleware/error.rb:76:in `instance_exec'
# ./lib/grape/middleware/error.rb:76:in `exec_handler'
# ./lib/grape/middleware/error.rb:45:in `rescue in call!'
# ./lib/grape/middleware/error.rb:32:in `call!'
# ./lib/grape/middleware/base.rb:23:in `call'
# /Users/dblock/.rvm/gems/ruby-2.3.1/gems/rack-1.6.4/lib/rack/head.rb:13:in `call'
# ./lib/grape/endpoint.rb:222:in `call!'
# ./lib/grape/endpoint.rb:216:in `call'
# ./lib/grape/router.rb:153:in `method_not_allowed'
# ./lib/grape/router.rb:98:in `transaction'
# ./lib/grape/router.rb:67:in `identity'
# ./lib/grape/router.rb:52:in `block in call'
# ./lib/grape/router.rb:115:in `with_optimization'
# ./lib/grape/router.rb:51:in `call'
# ./lib/grape/api.rb:119:in `call'
# ./lib/grape/api.rb:45:in `call!'
# ./lib/grape/api.rb:40:in `call'
# /Users/dblock/.rvm/gems/ruby-2.3.1/gems/rack-test-0.6.3/lib/rack/mock_session.rb:30:in `request'
# /Users/dblock/.rvm/gems/ruby-2.3.1/gems/rack-test-0.6.3/lib/rack/test.rb:244:in `process_request'
# /Users/dblock/.rvm/gems/ruby-2.3.1/gems/rack-test-0.6.3/lib/rack/test.rb:58:in `get'
# ./spec/grape/integration/error_in_middleware_spec.rb:34:in `block (2 levels) in <top (required)>'
# ------------------
# --- Caused by: ---
# Grape::Exceptions::MethodNotAllowed:
# 405 Not Allowed
# ./lib/grape/router.rb:150:in `block (2 levels) in method_not_allowed'
Finished in 0.02251 seconds (files took 0.38461 seconds to load)
2 examples, 1 failure
The text was updated successfully, but these errors were encountered:
This is caused by #1421, @namusyaka I think this is not a bug and by injecting helpers here we're doing the "right thing". Do let me know if you're thinking otherwise, I'll PR an UPGRADING text.
In Grape 0.16.2 this passes.
In Grape 0.16.3 this fails with
The text was updated successfully, but these errors were encountered: