From d72b2583cf679b75ef2fd50055fdd3d20a136b9c Mon Sep 17 00:00:00 2001 From: will bailey Date: Sun, 7 Feb 2010 13:48:21 -0500 Subject: [PATCH] TestUploadedFile should indicate that it respond_to? methods of tempfile (eg respond_to?(:read) --- actionpack/lib/action_controller/test_process.rb | 6 ++++++ actionpack/test/controller/test_test.rb | 2 +- 2 files changed, 7 insertions(+), 1 deletions(-) diff --git a/actionpack/lib/action_controller/test_process.rb b/actionpack/lib/action_controller/test_process.rb index fd9f90b..93b6dfe 100644 --- a/actionpack/lib/action_controller/test_process.rb +++ b/actionpack/lib/action_controller/test_process.rb @@ -389,6 +389,12 @@ module ActionController #:nodoc: def method_missing(method_name, *args, &block) #:nodoc: @tempfile.__send__(method_name, *args, &block) end + + alias_method :original_respond_to?, :respond_to? + def respond_to?(method, include_private = false) #:nodoc: + return true if @tempfile.respond_to?(method, include_private) + respond_to?(method, include_private) + end end module TestProcess diff --git a/actionpack/test/controller/test_test.rb b/actionpack/test/controller/test_test.rb index 3924b28..66a1682 100644 --- a/actionpack/test/controller/test_test.rb +++ b/actionpack/test/controller/test_test.rb @@ -566,7 +566,7 @@ XML new_content_type = "new content_type" file.content_type = new_content_type assert_equal new_content_type, file.content_type - + assert file.respond_to?(:read) end def test_test_uploaded_file_with_binary -- 1.6.4.2