diff options
author | Alexey Vakhov <vakhov@gmail.com> | 2011-10-03 12:05:25 +0400 |
---|---|---|
committer | Alexey Vakhov <vakhov@gmail.com> | 2011-10-03 14:27:42 +0400 |
commit | 8df7fe3f630e13da1585c151f6f2f986ea7dcdfd (patch) | |
tree | 4254e070ffdc72ada7dbef23e4ae7ae490aae3db | |
parent | 0defbc6bfeff053983ef65739b2dcc080b2ad227 (diff) | |
download | rails-8df7fe3f630e13da1585c151f6f2f986ea7dcdfd.tar.gz rails-8df7fe3f630e13da1585c151f6f2f986ea7dcdfd.tar.bz2 rails-8df7fe3f630e13da1585c151f6f2f986ea7dcdfd.zip |
normalize arg for ActionView::TestCase tests method
-rw-r--r-- | actionpack/lib/action_view/test_case.rb | 7 | ||||
-rw-r--r-- | actionpack/test/template/test_test.rb | 16 |
2 files changed, 22 insertions, 1 deletions
diff --git a/actionpack/lib/action_view/test_case.rb b/actionpack/lib/action_view/test_case.rb index c4d51d7946..7df95b0cb0 100644 --- a/actionpack/lib/action_view/test_case.rb +++ b/actionpack/lib/action_view/test_case.rb @@ -50,7 +50,12 @@ module ActionView module ClassMethods def tests(helper_class) - self.helper_class = helper_class + case helper_class + when String, Symbol + self.helper_class = "#{helper_class.to_s.underscore}_helper".camelize.safe_constantize + when Module + self.helper_class = helper_class + end end def determine_default_helper_class(name) diff --git a/actionpack/test/template/test_test.rb b/actionpack/test/template/test_test.rb index bf789cd8b7..adcbf1447f 100644 --- a/actionpack/test/template/test_test.rb +++ b/actionpack/test/template/test_test.rb @@ -62,3 +62,19 @@ class CrazyHelperTest < ActionView::TestCase assert_equal PeopleHelper, self.class.helper_class end end + +class CrazySymbolHelperTest < ActionView::TestCase + tests :people + + def test_set_helper_class_using_symbol + assert_equal PeopleHelper, self.class.helper_class + end +end + +class CrazyStringHelperTest < ActionView::TestCase + tests 'people' + + def test_set_helper_class_using_string + assert_equal PeopleHelper, self.class.helper_class + end +end |