-
-
Notifications
You must be signed in to change notification settings - Fork 942
Closed
Labels
Milestone
Description
Environment
- jruby 9.1.3.0 (2.3.1) 2016-08-29 a2a3b29 Java HotSpot(TM) 64-Bit Server VM 25.74-b02 on 1.8.0_74-b02 [darwin-x86_64
- Darwin LAXM00618506A 15.6.0 Darwin Kernel Version 15.6.0: Thu Jun 23 18:25:34 PDT 2016; root:xnu-3248.60.10~1/RELEASE_X86_64 x86_64
Expected Behavior
When a rails app has routing contraints such as:
controller "home" do
get "/home" => "home#list", constraints: -> (_request) { false }
get "/home" => "home#index"
end
A request to "/home" does not match the constraints for the #list endpoint therefore it passes through to the #index endpoint when under Ruby 2.3.1 and JRuby 9.1.2.0. When under JRuby 9.1.3.0 the same request fails with a routing error.
You can find the repro code here https://github.com/creddy/request_contraints
➜ routing_contraints [jruby-9.1.2.0] (master) jruby -v
jruby 9.1.2.0 (2.3.0) 2016-05-26 7357c8f Java HotSpot(TM) 64-Bit Server VM 25.74-b02 on 1.8.0_74-b02 [darwin-x86_64]
➜ routing_contraints [jruby-9.1.2.0] (master) rspec spec --format documentation
Home routing
get /home
returns successfully
Finished in 0.469 seconds (files took 2.64 seconds to load)
1 example, 0 failures
➜ routing_contraints [2.3.1] (master) ruby -v
ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin15]
➜ routing_contraints [2.3.1] (master) rspec spec
.
Finished in 0.27264 seconds (files took 0.93337 seconds to load)
1 example, 0 failures
Actual Behavior
- In JRuby 9.1.3.0 the constraint is not matched and a routing error is raised instead of falling through to the next match.
➜ routing_contraints [jruby-9.1.3.0] (master) jruby -v
jruby 9.1.3.0 (2.3.1) 2016-08-29 a2a3b29 Java HotSpot(TM) 64-Bit Server VM 25.74-b02 on 1.8.0_74-b02 [darwin-x86_64]
➜ routing_contraints [jruby-9.1.3.0] (master) rspec spec
F
Failures:
1) Home routing get /home returns successfully
Failure/Error: get "/home"
ActionController::RoutingError:
No route matches [GET] "/home"
# ./spec/requests/home_spec.rb:6:in `block in (root)'
Finished in 0.411 seconds (files took 2.57 seconds to load)
1 example, 1 failure
Failed examples:
rspec ./spec/requests/home_spec.rb:5 # Home routing get /home returns successfully
Thank you
Reactions are currently unavailable