Skip to content

Commit

Permalink
Ruby 1.9: fix encoding for test_file_stream
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremy committed Aug 2, 2009
1 parent ec94c25 commit f2a3572
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion actionpack/test/controller/send_file_test.rb
Expand Up @@ -4,7 +4,7 @@
module TestFileUtils
def file_name() File.basename(__FILE__) end
def file_path() File.expand_path(__FILE__) end
def file_data() File.open(file_path, 'rb') { |f| f.read } end
def file_data() @data ||= File.open(file_path, 'rb') { |f| f.read } end
end

class SendFileController < ActionController::Base
Expand Down Expand Up @@ -60,6 +60,7 @@ def test_file_stream
require 'stringio'
output = StringIO.new
output.binmode
output.string.force_encoding(file_data.encoding) if output.string.respond_to?(:force_encoding)
assert_nothing_raised { response.body_parts.each { |part| output << part.to_s } }
assert_equal file_data, output.string
end
Expand Down

0 comments on commit f2a3572

Please sign in to comment.