diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2011-03-11 18:06:10 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2011-03-11 18:06:22 -0800 |
commit | 89c5b9aee7d7db95cec9e5a934c3761872ab107e (patch) | |
tree | 0eb6c9ea9d2caf43cd4c7eee423284853220e233 /actionpack/test | |
parent | 53794cf7b5a9f66c3173f4ca9a5ee3279965a3a0 (diff) | |
download | rails-89c5b9aee7d7db95cec9e5a934c3761872ab107e.tar.gz rails-89c5b9aee7d7db95cec9e5a934c3761872ab107e.tar.bz2 rails-89c5b9aee7d7db95cec9e5a934c3761872ab107e.zip |
do not automatically add format to routes that end in a slash
Diffstat (limited to 'actionpack/test')
-rw-r--r-- | actionpack/test/action_dispatch/routing/mapper_test.rb | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/actionpack/test/action_dispatch/routing/mapper_test.rb b/actionpack/test/action_dispatch/routing/mapper_test.rb new file mode 100644 index 0000000000..9966234f1b --- /dev/null +++ b/actionpack/test/action_dispatch/routing/mapper_test.rb @@ -0,0 +1,51 @@ +require 'abstract_unit' + +module ActionDispatch + module Routing + class MapperTest < ActiveSupport::TestCase + class FakeSet + attr_reader :routes + + def initialize + @routes = [] + end + + def resources_path_names + {} + end + + def request_class + ActionDispatch::Request + end + + def add_route(*args) + routes << args + end + + def conditions + routes.map { |x| x[1] } + end + end + + def test_initialize + Mapper.new FakeSet.new + end + + def test_map_slash + fakeset = FakeSet.new + mapper = Mapper.new fakeset + mapper.match '/', :to => 'posts#index', :as => :main + assert_equal '/', fakeset.conditions.first[:path_info] + end + + def test_map_more_slashes + fakeset = FakeSet.new + mapper = Mapper.new fakeset + + # FIXME: is this a desired behavior? + mapper.match '/one/two/', :to => 'posts#index', :as => :main + assert_equal '/one/two(.:format)', fakeset.conditions.first[:path_info] + end + end + end +end |