mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
normalize arg for ActionView::TestCase tests method
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user