diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2014-05-27 14:40:55 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2014-05-27 14:40:55 -0700 |
commit | cfdab77d1fd39a887e9d94342e4e85f915a5b00b (patch) | |
tree | 6a2e75717181bcb7d4d47cd111ac4ad92107075e /actionpack/test | |
parent | babcd7d375bc39b3df5526bde0380e0d6d3d243b (diff) | |
parent | 406b1b64649f48bdd724826a05c06fb78f5378ea (diff) | |
download | rails-cfdab77d1fd39a887e9d94342e4e85f915a5b00b.tar.gz rails-cfdab77d1fd39a887e9d94342e4e85f915a5b00b.tar.bz2 rails-cfdab77d1fd39a887e9d94342e4e85f915a5b00b.zip |
Merge branch 'constraints'
* constraints:
rm reset_parameters because we automatically do it from 9ca4839a
move path_parameter encoding check to the request object
dispatcher doesn't need `call` anymore
call `serve` with the request on dispatchers
constraints class does not need the request class anymore
give all endpoints a superclass
skip the build business if the stack is empty
stop hardcoding path_parameters and get it from the request
we do not need to cache rack_app
a redirect is not a dispatcher by definition, so eliminate test
push is_a check up to where the Constraints object is allocated
pass the request object to the application
pass a request to `matches?` so we can avoid creating excess requests
nothing is passed to `rack_app` anymore, so rm the params
one fewer is_a check
Constraints#app should never return another Constraints object, so switch to if statement
eliminate dispatcher is_a checks
push is_a?(Dispatcher) check in to one place
Always construct route objects with Constraint objects
Conflicts:
actionpack/lib/action_controller/metal.rb
Diffstat (limited to 'actionpack/test')
-rw-r--r-- | actionpack/test/journey/router_test.rb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/actionpack/test/journey/router_test.rb b/actionpack/test/journey/router_test.rb index db2d3bc10d..1a2106a3c5 100644 --- a/actionpack/test/journey/router_test.rb +++ b/actionpack/test/journey/router_test.rb @@ -9,6 +9,7 @@ module ActionDispatch def initialize super({}) end + def dispatcher?; true; end end attr_reader :routes @@ -217,13 +218,16 @@ module ActionDispatch end def test_clear_trailing_slash_from_script_name_on_root_unanchored_routes + route_set = Routing::RouteSet.new + mapper = Routing::Mapper.new route_set + strexp = Router::Strexp.new("/", {}, ['/', '.', '?'], false) path = Path::Pattern.new strexp app = lambda { |env| [200, {}, ['success!']] } - @router.routes.add_route(app, path, {}, {}, {}) + mapper.get '/weblog', :to => app env = rack_env('SCRIPT_NAME' => '', 'PATH_INFO' => '/weblog') - resp = @router.serve rails_env env + resp = route_set.call env assert_equal ['success!'], resp.last assert_equal '', env['SCRIPT_NAME'] end |