aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/template/test_case_test.rb
diff options
context:
space:
mode:
authorSantiago Pastorino <santiago@wyeworks.com>2011-01-12 12:14:00 -0200
committerSantiago Pastorino <santiago@wyeworks.com>2011-01-12 12:14:00 -0200
commit6062d434f174c84a18a121b025dcf4f11d6689f1 (patch)
tree782bd5a01299a8167ca10eb93178119ecde6d3d4 /actionpack/test/template/test_case_test.rb
parentf8700038afdaea80cad34a4fca005e1ef068b53e (diff)
downloadrails-6062d434f174c84a18a121b025dcf4f11d6689f1.tar.gz
rails-6062d434f174c84a18a121b025dcf4f11d6689f1.tar.bz2
rails-6062d434f174c84a18a121b025dcf4f11d6689f1.zip
Allow view in AV::TestCase to access it's controller helpers methods
Diffstat (limited to 'actionpack/test/template/test_case_test.rb')
-rw-r--r--actionpack/test/template/test_case_test.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/actionpack/test/template/test_case_test.rb b/actionpack/test/template/test_case_test.rb
index a745999622..203515d508 100644
--- a/actionpack/test/template/test_case_test.rb
+++ b/actionpack/test/template/test_case_test.rb
@@ -116,6 +116,27 @@ module ActionView
end
end
+ class ControllerHelperMethod < ActionView::TestCase
+ module SomeHelper
+ def some_method
+ render :partial => 'test/from_helper'
+ end
+ end
+
+ helper SomeHelper
+
+ test "can call a helper method defined on the current controller from a helper" do
+ @controller.singleton_class.class_eval <<-EOF, __FILE__, __LINE__ + 1
+ def render_from_helper
+ 'controller_helper_method'
+ end
+ EOF
+ @controller.class.helper_method :render_from_helper
+
+ assert_equal 'controller_helper_method', some_method
+ end
+ end
+
class AssignsTest < ActionView::TestCase
setup do
ActiveSupport::Deprecation.stubs(:warn)