diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2008-05-26 01:38:56 -0700 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2008-05-26 01:38:56 -0700 |
commit | 7520770c825eab21079dd2b69b1199f138294301 (patch) | |
tree | 2ff015e1747a36eabc0c132359da7b7129457cf2 /actionpack | |
parent | c5d37c0662a65ce9723d668f57b59457e79ee5ca (diff) | |
download | rails-7520770c825eab21079dd2b69b1199f138294301.tar.gz rails-7520770c825eab21079dd2b69b1199f138294301.tar.bz2 rails-7520770c825eab21079dd2b69b1199f138294301.zip |
Don't require AV::TestCases to have a helper class. Only include the helper class in setup if it hasn't been already.
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/lib/action_view/test_case.rb | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/actionpack/lib/action_view/test_case.rb b/actionpack/lib/action_view/test_case.rb index b2e6589d81..16fedd9732 100644 --- a/actionpack/lib/action_view/test_case.rb +++ b/actionpack/lib/action_view/test_case.rb @@ -1,14 +1,6 @@ require 'active_support/test_case' module ActionView - class NonInferrableHelperError < ActionViewError - def initialize(name) - super "Unable to determine the helper to test from #{name}. " + - "You'll need to specify it using tests YourHelper in your " + - "test case definition" - end - end - class TestCase < ActiveSupport::TestCase class_inheritable_accessor :helper_class @@helper_class = nil @@ -29,7 +21,7 @@ module ActionView def determine_default_helper_class(name) name.sub(/Test$/, '').constantize rescue NameError - raise NonInferrableHelperError.new(name) + nil end end @@ -42,7 +34,9 @@ module ActionView setup :setup_with_helper_class def setup_with_helper_class - self.class.send(:include, helper_class) + if helper_class && !self.class.ancestors.include?(helper_class) + self.class.send(:include, helper_class) + end end class TestController < ActionController::Base |