diff options
author | Piotr Sarnacki <drogus@gmail.com> | 2010-06-24 14:32:11 +0200 |
---|---|---|
committer | Piotr Sarnacki <drogus@gmail.com> | 2010-09-03 22:59:04 +0200 |
commit | c989d1a87d4ed0d3f4fe425ce2207eec5a8d3154 (patch) | |
tree | c4e9df3db8971f0877380bff56cca9a1c24b037d /railties/test | |
parent | b5975a4a30edb1b77a4d7edd6817a7445c079193 (diff) | |
download | rails-c989d1a87d4ed0d3f4fe425ce2207eec5a8d3154.tar.gz rails-c989d1a87d4ed0d3f4fe425ce2207eec5a8d3154.tar.bz2 rails-c989d1a87d4ed0d3f4fe425ce2207eec5a8d3154.zip |
Engine sets routes as default rack endpoint if no endpoint was given
Diffstat (limited to 'railties/test')
-rw-r--r-- | railties/test/railties/engine_test.rb | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/railties/test/railties/engine_test.rb b/railties/test/railties/engine_test.rb index a0028c1d70..a2d46f02e7 100644 --- a/railties/test/railties/engine_test.rb +++ b/railties/test/railties/engine_test.rb @@ -86,11 +86,35 @@ module RailtiesTest assert_equal "HELLO WORLD", response[2] end + test "it provides routes as default endpoint" do + @plugin.write "lib/bukkits.rb", <<-RUBY + class Bukkits + class Engine < ::Rails::Engine + end + end + RUBY + + boot_rails + + Bukkits::Engine.routes.draw do |map| + match "/foo" => lambda { |env| [200, {'Content-Type' => 'text/html'}, 'foo'] } + end + + Rails::Application.routes.draw do |map| + mount(Bukkits::Engine => "/bukkits") + end + + env = Rack::MockRequest.env_for("/bukkits/foo") + response = Rails::Application.call(env) + + assert_equal "foo", response[2] + end + test "engine can load its own plugins" do @plugin.write "lib/bukkits.rb", <<-RUBY class Bukkits class Engine < ::Rails::Engine - config.paths.vendor.plugins = "#{File.join(@plugin.path, "lib/bukkits/plugins")}" + paths.vendor.plugins = "#{File.join(@plugin.path, "lib/bukkits/plugins")}" end end RUBY |