I have two failing tests (below) that illustrate my expected behaviour. I’m just not sure that my expectations are correct.
In a nutshell. Should ‘/foo/bar%2Fbaz’ try to match [‘foo’, ‘bar’, ‘baz’] or [‘foo’, ‘bar%2Fbaz’].
Chris
class UriReservedCharactersRoutingTest < Test::Unit::TestCase
def setup
ActionController::Routing.use_controllers! [‘controller’]
@set = ActionController::Routing::
RouteSet.new
@set.draw do |map|
map.connect ‘:controller/:action/:var’
end
end
def test_should_escape_reserved_uri_characters_within_individual_path_components
assert_equal ‘/controller/action/p1%2Fp2’, @
set.generate(:controller => ‘controller’, :action => ‘action’, :var => ‘p1/p2’)
end
def test_should_recognize_escaped_path_component_and_unescape
expected_options = {:var => “p1/p2”, :controller => “controller”, :action => “action”}
assert_equal expected_options, @set.recognize_path('/controller/action/p1%2Fp2')
end
end