diff options
author | Piotr Sarnacki <drogus@gmail.com> | 2012-03-13 20:04:41 +0100 |
---|---|---|
committer | Piotr Sarnacki <drogus@gmail.com> | 2012-03-13 21:01:44 +0100 |
commit | 24e00e1eb7bccb479787e78bf63ae739105b72b7 (patch) | |
tree | f6d31835e5790b863251522d80cff57ade7c1afc /railties | |
parent | a85714a673d2e06b923bd4eba443a3849d332cce (diff) | |
download | rails-24e00e1eb7bccb479787e78bf63ae739105b72b7.tar.gz rails-24e00e1eb7bccb479787e78bf63ae739105b72b7.tar.bz2 rails-24e00e1eb7bccb479787e78bf63ae739105b72b7.zip |
Ensure that engine can be mounted at root (#4314)
It's already fixed and the fix was actually in journey library,
but with #4314 it reappeared second time, so probably this
kind of integration test will be good to have to not allow it to
sneak in after changes in journey or rails itself.
Diffstat (limited to 'railties')
-rw-r--r-- | railties/test/railties/engine_test.rb | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/railties/test/railties/engine_test.rb b/railties/test/railties/engine_test.rb index 5ed923a484..36de773633 100644 --- a/railties/test/railties/engine_test.rb +++ b/railties/test/railties/engine_test.rb @@ -753,6 +753,60 @@ module RailtiesTest assert_equal "Bukkit's foo partial", last_response.body.strip end + test "engine can be properly mounted at root" do + add_to_config("config.action_dispatch.show_exceptions = false") + add_to_config("config.serve_static_assets = false") + + @plugin.write "lib/bukkits.rb", <<-RUBY + module Bukkits + class Engine < ::Rails::Engine + isolate_namespace ::Bukkits + end + end + RUBY + + @plugin.write "config/routes.rb", <<-RUBY + Bukkits::Engine.routes.draw do + root "foo#index" + end + RUBY + + @plugin.write "app/controllers/bukkits/foo_controller.rb", <<-RUBY + module Bukkits + class FooController < ActionController::Base + def index + text = <<-TEXT + script_name: \#{request.script_name} + fullpath: \#{request.fullpath} + path: \#{request.path} + TEXT + render :text => text + end + end + end + RUBY + + + app_file "config/routes.rb", <<-RUBY + Rails.application.routes.draw do + mount Bukkits::Engine => "/" + end + RUBY + + boot_rails + require "#{rails_root}/config/environment" + + expected = <<-TEXT + script_name: + fullpath: / + path: / + TEXT + + get("/") + assert_equal expected.split("\n").map(&:strip), + last_response.body.split("\n").map(&:strip) + end + private def app Rails.application |