Preventing an endless loop in case test_helper is loaded twice

(note to self: _always_ enclose alias within unless method_defined?)
This commit is contained in:
Alexey Verkhovsky 2005-01-23 19:12:57 +00:00
parent 780891349a
commit 584c4b39ef

View file

@ -5,7 +5,7 @@ require 'test/unit'
require 'action_controller/test_process' require 'action_controller/test_process'
# Uncomment this variable to have assert_success check that response bodies are valid XML # Uncomment this variable to have assert_success check that response bodies are valid XML
# $validate_xml_in_assert_success = true $validate_xml_in_assert_success = true
# Convenient setup method for Test::Unit::TestCase # Convenient setup method for Test::Unit::TestCase
class Test::Unit::TestCase class Test::Unit::TestCase
@ -99,7 +99,9 @@ if defined? $validate_xml_in_assert_success and $validate_xml_in_assert_success
module Test module Test
module Unit module Unit
module Assertions module Assertions
alias :__assert_success_before_ovverride_by_instiki :assert_success unless method_defined? :__assert_success_before_ovverride_by_instiki
alias :__assert_success_before_ovverride_by_instiki :assert_success
end
def assert_success def assert_success
__assert_success_before_ovverride_by_instiki __assert_success_before_ovverride_by_instiki
if @response.body.kind_of?(Proc) then # it's a file download, not an HTML content if @response.body.kind_of?(Proc) then # it's a file download, not an HTML content