aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test/plugins/vendored_test.rb
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2010-01-24 14:48:00 +0100
committerJosé Valim <jose.valim@gmail.com>2010-01-24 14:48:00 +0100
commit84ebfa4550b2325c6c89bc13aa6f904ff88d0db7 (patch)
tree7328c06394e114903a57aea89b94411986e9eaf1 /railties/test/plugins/vendored_test.rb
parentdd05b6c543f48050f494214da7803da6f5655292 (diff)
downloadrails-84ebfa4550b2325c6c89bc13aa6f904ff88d0db7.tar.gz
rails-84ebfa4550b2325c6c89bc13aa6f904ff88d0db7.tar.bz2
rails-84ebfa4550b2325c6c89bc13aa6f904ff88d0db7.zip
Ensure metals and initializers in plugins are loaded.
Diffstat (limited to 'railties/test/plugins/vendored_test.rb')
-rw-r--r--railties/test/plugins/vendored_test.rb28
1 files changed, 28 insertions, 0 deletions
diff --git a/railties/test/plugins/vendored_test.rb b/railties/test/plugins/vendored_test.rb
index 86f3ecd1f7..05c01846e1 100644
--- a/railties/test/plugins/vendored_test.rb
+++ b/railties/test/plugins/vendored_test.rb
@@ -221,6 +221,24 @@ YAML
assert_equal "1", I18n.t(:bar)
end
+ test "plugin metals are added to the middleware stack" do
+ @plugin.write 'app/metal/foo_metal.rb', <<-RUBY
+ class FooMetal
+ def self.call(env)
+ [200, { "Content-Type" => "text/html"}, ["FooMetal"]]
+ end
+ end
+ RUBY
+
+ boot_rails
+ require 'rack/test'
+ extend Rack::Test::Methods
+
+ get "/"
+ assert_equal 200, last_response.status
+ assert_equal "FooMetal", last_response.body
+ end
+
test "namespaced controllers with namespaced routes" do
@plugin.write "config/routes.rb", <<-RUBY
ActionController::Routing::Routes.draw do
@@ -248,6 +266,16 @@ YAML
assert_equal "Rendered from namespace", last_response.body
end
+ test "plugin with initializers" do
+ $plugin_initializer = false
+ @plugin.write "config/initializers/foo.rb", <<-RUBY
+ $plugin_initializer = true
+ RUBY
+
+ boot_rails
+ assert $plugin_initializer
+ end
+
test "plugin cannot declare an engine for it" do
@plugin.write "lib/bukkits.rb", <<-RUBY
class Bukkits