aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test
diff options
context:
space:
mode:
authorPiotr Sarnacki <drogus@gmail.com>2010-08-23 19:25:04 +0200
committerPiotr Sarnacki <drogus@gmail.com>2010-09-03 22:59:13 +0200
commite35c2043b135a95104e3eeb3e12cbcde541fa1b4 (patch)
tree896b91d776eac389300edd653ed20c88fcf11218 /railties/test
parent98ab4ded376c3d04540bdbdfe6dbbf88c0738701 (diff)
downloadrails-e35c2043b135a95104e3eeb3e12cbcde541fa1b4.tar.gz
rails-e35c2043b135a95104e3eeb3e12cbcde541fa1b4.tar.bz2
rails-e35c2043b135a95104e3eeb3e12cbcde541fa1b4.zip
Include all helpers from non-namespaced engines
Diffstat (limited to 'railties/test')
-rw-r--r--railties/test/railties/engine_test.rb19
1 files changed, 18 insertions, 1 deletions
diff --git a/railties/test/railties/engine_test.rb b/railties/test/railties/engine_test.rb
index fff925404d..6deca9cf1e 100644
--- a/railties/test/railties/engine_test.rb
+++ b/railties/test/railties/engine_test.rb
@@ -304,11 +304,12 @@ module RailtiesTest
assert_equal response[2].path, File.join(app_path, "public/bukkits/file_from_app.html")
end
- test "shared engine should include application's helpers" do
+ test "shared engine should include application's helpers and own helpers" do
app_file "config/routes.rb", <<-RUBY
AppTemplate::Application.routes.draw do
match "/foo" => "bukkits/foo#index", :as => "foo"
match "/foo/show" => "bukkits/foo#show"
+ match "/foo/bar" => "bukkits/foo#bar"
end
RUBY
@@ -320,6 +321,14 @@ module RailtiesTest
end
RUBY
+ @plugin.write "app/helpers/bar_helper.rb", <<-RUBY
+ module BarHelper
+ def bar
+ "It's a bar."
+ end
+ end
+ RUBY
+
@plugin.write "app/controllers/bukkits/foo_controller.rb", <<-RUBY
class Bukkits::FooController < ActionController::Base
def index
@@ -329,6 +338,10 @@ module RailtiesTest
def show
render :text => foo_path
end
+
+ def bar
+ render :inline => "<%= bar %>"
+ end
end
RUBY
@@ -341,6 +354,10 @@ module RailtiesTest
env = Rack::MockRequest.env_for("/foo/show")
response = Rails.application.call(env)
assert_equal "/foo", response[2].body
+
+ env = Rack::MockRequest.env_for("/foo/bar")
+ response = Rails.application.call(env)
+ assert_equal "It's a bar.", response[2].body
end
test "namespaced engine should include only its own routes and helpers" do