diff options
author | Piotr Sarnacki <drogus@gmail.com> | 2011-04-25 13:12:07 +0200 |
---|---|---|
committer | Piotr Sarnacki <drogus@gmail.com> | 2011-04-25 13:44:27 +0200 |
commit | e38b4436a57c43d2db78a4c8a647a09fe0e5d2c5 (patch) | |
tree | ed59432bcdf0343a83b3c40364c13969c3d563ea /railties/test | |
parent | 723a0f82c48e4aa7987c6ccf653b4e543a0d3715 (diff) | |
download | rails-e38b4436a57c43d2db78a4c8a647a09fe0e5d2c5.tar.gz rails-e38b4436a57c43d2db78a4c8a647a09fe0e5d2c5.tar.bz2 rails-e38b4436a57c43d2db78a4c8a647a09fe0e5d2c5.zip |
Add Engine#helpers method which loads all the engine's helpers
Diffstat (limited to 'railties/test')
-rw-r--r-- | railties/test/railties/engine_test.rb | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/railties/test/railties/engine_test.rb b/railties/test/railties/engine_test.rb index 7605984684..b3cf9ad449 100644 --- a/railties/test/railties/engine_test.rb +++ b/railties/test/railties/engine_test.rb @@ -584,6 +584,51 @@ module RailtiesTest assert_equal Bukkits::Engine.instance, Rails::Engine.find(engine_path) end + test "gather isolated engine's helpers in Engine#helpers" do + @plugin.write "lib/bukkits.rb", <<-RUBY + module Bukkits + class Engine < ::Rails::Engine + isolate_namespace Bukkits + end + end + RUBY + + app_file "app/helpers/some_helper.rb", <<-RUBY + module SomeHelper + def foo + 'foo' + end + end + RUBY + + @plugin.write "app/helpers/bukkits/engine_helper.rb", <<-RUBY + module Bukkits + module EngineHelper + def bar + 'bar' + end + end + end + RUBY + + @plugin.write "app/helpers/engine_helper.rb", <<-RUBY + module EngineHelper + def baz + 'baz' + end + end + RUBY + + add_to_config("config.action_dispatch.show_exceptions = false") + + boot_rails + require "#{rails_root}/config/environment" + + methods = Bukkits::Engine.helpers.public_instance_methods.sort + expected = ["bar", "baz"] + assert_equal expected, methods + end + private def app Rails.application |