aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test
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
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')
-rw-r--r--railties/test/initializer/path_test.rb4
-rw-r--r--railties/test/plugins/vendored_test.rb28
2 files changed, 31 insertions, 1 deletions
diff --git a/railties/test/initializer/path_test.rb b/railties/test/initializer/path_test.rb
index 54bdddbdf2..7a40d7fa6e 100644
--- a/railties/test/initializer/path_test.rb
+++ b/railties/test/initializer/path_test.rb
@@ -38,6 +38,7 @@ module InitializerTests
test "booting up Rails yields a valid paths object" do
assert_path @paths.app.metals, "app", "metal"
+ assert_path @paths.app.helpers, "app", "helpers"
assert_path @paths.app.views, "app", "views"
assert_path @paths.lib, "lib"
assert_path @paths.vendor, "vendor"
@@ -56,7 +57,7 @@ module InitializerTests
test "booting up Rails yields a list of paths that are eager" do
assert @paths.app.eager_load?
assert @paths.app.controllers.eager_load?
- assert @paths.app.metals.eager_load?
+ assert @paths.app.helpers.eager_load?
end
test "environments has a glob equal to the current environment" do
@@ -70,6 +71,7 @@ module InitializerTests
assert_in_load_path "lib"
assert_in_load_path "vendor"
+ assert_not_in_load_path "app", "metal"
assert_not_in_load_path "config"
assert_not_in_load_path "config", "locales"
assert_not_in_load_path "config", "environments"
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