aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2008-04-01 06:58:52 +0000
committerJeremy Kemper <jeremy@bitsweat.net>2008-04-01 06:58:52 +0000
commit300c927b6c99e3a949ce701e680124d0e829a070 (patch)
treee302927899a966b6bb07bb645891473dbb201bc9
parentba8e0a846f0e5ee84a16a5e128106883f6d10b71 (diff)
downloadrails-300c927b6c99e3a949ce701e680124d0e829a070.tar.gz
rails-300c927b6c99e3a949ce701e680124d0e829a070.tar.bz2
rails-300c927b6c99e3a949ce701e680124d0e829a070.zip
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
-rw-r--r--activerecord/test/cases/binary_test.rb4
-rwxr-xr-xactiverecord/test/cases/fixtures_test.rb4
2 files changed, 6 insertions, 2 deletions
diff --git a/activerecord/test/cases/binary_test.rb b/activerecord/test/cases/binary_test.rb
index 2effa5736f..7131532c05 100644
--- a/activerecord/test/cases/binary_test.rb
+++ b/activerecord/test/cases/binary_test.rb
@@ -17,7 +17,9 @@ unless current_adapter?(:SQLServerAdapter, :SybaseAdapter, :DB2Adapter, :Firebir
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'
diff --git a/activerecord/test/cases/fixtures_test.rb b/activerecord/test/cases/fixtures_test.rb
index bedb26f28d..182f4f0f0b 100755
--- a/activerecord/test/cases/fixtures_test.rb
+++ b/activerecord/test/cases/fixtures_test.rb
@@ -180,7 +180,9 @@ class FixturesTest < ActiveRecord::TestCase
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