Skip to content
This repository
Browse code

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 Kemper jeremy authored
4 activerecord/test/cases/binary_test.rb
@@ -17,7 +17,9 @@ def test_load_save
17 17 Binary.delete_all
18 18
19 19 FIXTURES.each do |filename|
20   - data = File.read(ASSETS_ROOT + "/#{filename}").freeze
  20 + data = File.read(ASSETS_ROOT + "/#{filename}")
  21 + data.force_encoding('ASCII-8BIT') if data.respond_to?(:force_encoding)
  22 + data.freeze
21 23
22 24 bin = Binary.new(:data => data)
23 25 assert_equal data, bin.data, 'Newly assigned data differs from original'
4 activerecord/test/cases/fixtures_test.rb
@@ -180,7 +180,9 @@ def test_subsubdir_file_with_arbitrary_name
180 180
181 181 def test_binary_in_fixtures
182 182 assert_equal 1, @binaries.size
183   - data = File.open(ASSETS_ROOT + "/flowers.jpg", "rb").read.freeze
  183 + data = File.read(ASSETS_ROOT + "/flowers.jpg")
  184 + data.force_encoding('ASCII-8BIT') if data.respond_to?(:force_encoding)
  185 + data.freeze
184 186 assert_equal data, @flowers.data
185 187 end
186 188 end

0 comments on commit 300c927

Please sign in to comment.
Something went wrong with that request. Please try again.