diff options
Diffstat (limited to 'actionpack/test')
-rw-r--r-- | actionpack/test/abstract_unit.rb | 1 | ||||
-rw-r--r-- | actionpack/test/controller/helper_test.rb | 16 | ||||
-rw-r--r-- | actionpack/test/fixtures/alternate_helpers/foo_helper.rb | 3 |
3 files changed, 19 insertions, 1 deletions
diff --git a/actionpack/test/abstract_unit.rb b/actionpack/test/abstract_unit.rb index 9623afa89d..76812b94df 100644 --- a/actionpack/test/abstract_unit.rb +++ b/actionpack/test/abstract_unit.rb @@ -1,6 +1,7 @@ $:.unshift(File.dirname(__FILE__) + '/../lib') $:.unshift(File.dirname(__FILE__) + '/../../activesupport/lib') $:.unshift(File.dirname(__FILE__) + '/fixtures/helpers') +$:.unshift(File.dirname(__FILE__) + '/fixtures/alternate_helpers') require 'rubygems' require 'yaml' diff --git a/actionpack/test/controller/helper_test.rb b/actionpack/test/controller/helper_test.rb index 83e3b085e7..5f36461b89 100644 --- a/actionpack/test/controller/helper_test.rb +++ b/actionpack/test/controller/helper_test.rb @@ -1,6 +1,6 @@ require 'abstract_unit' -ActionController::Helpers::HELPERS_DIR.replace File.dirname(__FILE__) + '/../fixtures/helpers' +ActionController::Base.helpers_dir = File.dirname(__FILE__) + '/../fixtures/helpers' class TestController < ActionController::Base attr_accessor :delegate_attr @@ -130,6 +130,20 @@ class HelperTest < Test::Unit::TestCase assert methods.include?('foobar') end + def test_all_helpers_with_alternate_helper_dir + @controller_class.helpers_dir = File.dirname(__FILE__) + '/../fixtures/alternate_helpers' + + # Reload helpers + @controller_class.master_helper_module = Module.new + @controller_class.helper :all + + # helpers/abc_helper.rb should not be included + assert !master_helper_methods.include?('bare_a') + + # alternate_helpers/foo_helper.rb + assert master_helper_methods.include?('baz') + end + def test_helper_proxy methods = ApplicationController.helpers.methods.map(&:to_s) diff --git a/actionpack/test/fixtures/alternate_helpers/foo_helper.rb b/actionpack/test/fixtures/alternate_helpers/foo_helper.rb new file mode 100644 index 0000000000..a956fce6fa --- /dev/null +++ b/actionpack/test/fixtures/alternate_helpers/foo_helper.rb @@ -0,0 +1,3 @@ +module FooHelper + def baz() end +end |