diff options
author | Piotr Sarnacki <drogus@gmail.com> | 2010-07-01 23:35:01 +0200 |
---|---|---|
committer | Piotr Sarnacki <drogus@gmail.com> | 2010-09-03 22:59:05 +0200 |
commit | 628b94fbc81cb02b753d0f717a875219853b5764 (patch) | |
tree | 1db9aed7699ce33b1907c381a9363e4cf31c4302 /railties/test | |
parent | 28016d33b0f2e668ca59a912c7fb2d777e3cf0a3 (diff) | |
download | rails-628b94fbc81cb02b753d0f717a875219853b5764.tar.gz rails-628b94fbc81cb02b753d0f717a875219853b5764.tar.bz2 rails-628b94fbc81cb02b753d0f717a875219853b5764.zip |
Pass routes via env['action_dispatch.routes'], it's needed by routes to determine if it should generate prefix for mounted apps
Diffstat (limited to 'railties/test')
-rw-r--r-- | railties/test/railties/engine_test.rb | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/railties/test/railties/engine_test.rb b/railties/test/railties/engine_test.rb index e8675daef0..4257a9fa83 100644 --- a/railties/test/railties/engine_test.rb +++ b/railties/test/railties/engine_test.rb @@ -177,5 +177,27 @@ module RailtiesTest assert Bukkits::Engine.config.environment_loaded end + + test "it passes router in env" do + @plugin.write "lib/bukkits.rb", <<-RUBY + class Bukkits + class Engine < ::Rails::Engine + endpoint lambda { |env| [200, {'Content-Type' => 'text/html'}, 'hello'] } + end + end + RUBY + + boot_rails + + env = Rack::MockRequest.env_for("/") + response = Bukkits::Engine.call(env) + + assert_equal Bukkits::Engine.routes, env['action_dispatch.routes'] + + env = Rack::MockRequest.env_for("/") + response = Rails.application.call(env) + + assert_equal Rails.application.routes, env['action_dispatch.routes'] + end end end |