diff options
author | Piotr Sarnacki <drogus@gmail.com> | 2010-07-05 17:40:35 +0200 |
---|---|---|
committer | Piotr Sarnacki <drogus@gmail.com> | 2010-09-03 22:59:04 +0200 |
commit | 092b148b21899173028675ef727f876fff5db1bc (patch) | |
tree | f1accb0004777dd39d7736d81d567b9c13f94f27 /railties/test | |
parent | c989d1a87d4ed0d3f4fe425ce2207eec5a8d3154 (diff) | |
download | rails-092b148b21899173028675ef727f876fff5db1bc.tar.gz rails-092b148b21899173028675ef727f876fff5db1bc.tar.bz2 rails-092b148b21899173028675ef727f876fff5db1bc.zip |
Engine can now serve files with ActionDispatch::Static
Diffstat (limited to 'railties/test')
-rw-r--r-- | railties/test/railties/engine_test.rb | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/railties/test/railties/engine_test.rb b/railties/test/railties/engine_test.rb index a2d46f02e7..b2e7be9749 100644 --- a/railties/test/railties/engine_test.rb +++ b/railties/test/railties/engine_test.rb @@ -127,5 +127,31 @@ module RailtiesTest assert Bukkits::Engine.config.yaffle_loaded end + + test "engine can serve files" do + @plugin.write "lib/bukkits.rb", <<-RUBY + class Bukkits + class Engine < ::Rails::Engine + paths.public = "#{File.join(@plugin.path, "lib/bukkits/public")}" + config.serve_static_assets = true + end + end + RUBY + + @plugin.write "lib/bukkits/public/omg.txt", <<-RUBY + OMG + RUBY + + boot_rails + + Rails::Application.routes.draw do |map| + mount(Bukkits::Engine => "/bukkits") + end + + env = Rack::MockRequest.env_for("/bukkits/omg.txt") + response = Rails::Application.call(env) + + assert_equal response[2].path, File.join(@plugin.path, "lib/bukkits/public/omg.txt") + end end end |