Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Ruby 1.9 compat: force encoding for binary comparison tests

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9193 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
commit 300c927b6c99e3a949ce701e680124d0e829a070 1 parent ba8e0a8
@jeremy jeremy authored
View
4 activerecord/test/cases/binary_test.rb
@@ -17,7 +17,9 @@ def test_load_save
Binary.delete_all
FIXTURES.each do |filename|
- data = File.read(ASSETS_ROOT + "/#{filename}").freeze
+ data = File.read(ASSETS_ROOT + "/#{filename}")
+ data.force_encoding('ASCII-8BIT') if data.respond_to?(:force_encoding)
+ data.freeze
bin = Binary.new(:data => data)
assert_equal data, bin.data, 'Newly assigned data differs from original'
View
4 activerecord/test/cases/fixtures_test.rb
@@ -180,7 +180,9 @@ def test_subsubdir_file_with_arbitrary_name
def test_binary_in_fixtures
assert_equal 1, @binaries.size
- data = File.open(ASSETS_ROOT + "/flowers.jpg", "rb").read.freeze
+ data = File.read(ASSETS_ROOT + "/flowers.jpg")
+ data.force_encoding('ASCII-8BIT') if data.respond_to?(:force_encoding)
+ data.freeze
assert_equal data, @flowers.data
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.