aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller/send_file_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/test/controller/send_file_test.rb')
-rw-r--r--actionpack/test/controller/send_file_test.rb41
1 files changed, 24 insertions, 17 deletions
diff --git a/actionpack/test/controller/send_file_test.rb b/actionpack/test/controller/send_file_test.rb
index 2e14a0a32c..0bc0eb2df6 100644
--- a/actionpack/test/controller/send_file_test.rb
+++ b/actionpack/test/controller/send_file_test.rb
@@ -11,12 +11,17 @@ class SendFileController < ActionController::Base
layout "layouts/standard" # to make sure layouts don't interfere
attr_writer :options
- def options() @options ||= {} end
+ def options
+ @options ||= {}
+ end
- def file() send_file(file_path, options) end
- def data() send_data(file_data, options) end
+ def file
+ send_file(file_path, options)
+ end
- def rescue_action(e) raise end
+ def data
+ send_data(file_data, options)
+ end
end
class SendFileTest < ActionController::TestCase
@@ -40,17 +45,19 @@ class SendFileTest < ActionController::TestCase
assert_equal file_data, response.body
end
- def test_file_stream
- response = nil
- assert_nothing_raised { response = process('file') }
- assert_not_nil response
- assert_kind_of Proc, response.body_parts
-
- require 'stringio'
- output = StringIO.new
- output.binmode
- assert_nothing_raised { response.body_parts.call(response, output) }
- assert_equal file_data, output.string
+ for_tag(:old_base) do
+ def test_file_stream
+ response = nil
+ assert_nothing_raised { response = process('file') }
+ assert_not_nil response
+ assert_kind_of Array, response.body_parts
+
+ require 'stringio'
+ output = StringIO.new
+ output.binmode
+ assert_nothing_raised { response.body_parts.each { |part| output << part.to_s } }
+ assert_equal file_data, output.string
+ end
end
def test_file_url_based_filename
@@ -149,13 +156,13 @@ class SendFileTest < ActionController::TestCase
define_method "test_send_#{method}_status" do
@controller.options = { :stream => false, :status => 500 }
assert_nothing_raised { assert_not_nil process(method) }
- assert_equal '500 Internal Server Error', @response.status
+ assert_equal 500, @response.status
end
define_method "test_default_send_#{method}_status" do
@controller.options = { :stream => false }
assert_nothing_raised { assert_not_nil process(method) }
- assert_equal ActionController::DEFAULT_RENDER_STATUS_CODE, @response.status
+ assert_equal 200, @response.status
end
end
end