File tree 2 files changed +14
-2
lines changed
lib/action_dispatch/journey/path
2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -45,13 +45,13 @@ def requirements_anchored?
45
45
46
46
terminals . each_with_index { |s , index |
47
47
next if index < 1
48
- next unless s . symbol?
48
+ next if s . type == :DOT || s . type == :SLASH
49
49
50
50
back = terminals [ index - 1 ]
51
51
fwd = terminals [ index + 1 ]
52
52
53
53
# we also don't support this yet, constraints must be regexps
54
- return false if s . regexp . is_a? ( Array )
54
+ return false if s . symbol? && s . regexp . is_a? ( Array )
55
55
56
56
return false if back . literal?
57
57
return false if !fwd . nil? && fwd . literal?
Original file line number Diff line number Diff line change @@ -1459,6 +1459,18 @@ def test_optional_scoped_root_multiple_choice
1459
1459
assert_equal "projects#index" , @response . body
1460
1460
end
1461
1461
1462
+ def test_optional_part_of_segment
1463
+ draw do
1464
+ get "/star-trek(-tng)/:episode" , to : "star_trek#show"
1465
+ end
1466
+
1467
+ get "/star-trek/02-15-the-trouble-with-tribbles"
1468
+ assert_equal "star_trek#show" , @response . body
1469
+
1470
+ get "/star-trek-tng/05-02-darmok"
1471
+ assert_equal "star_trek#show" , @response . body
1472
+ end
1473
+
1462
1474
def test_scope_with_format_option
1463
1475
draw do
1464
1476
get "direct/index" , as : :no_format_direct , format : false
You can’t perform that action at this time.
0 commit comments