3 # Without using prepared statements, it makes no sense to test
4 # BLOB data with DB2 or Firebird, because the length of a statement
6 unless current_adapter
?(:SybaseAdapter, :DB2Adapter, :FirebirdAdapter)
7 require 'models/binary'
9 class BinaryTest
< ActiveRecord
::TestCase
10 FIXTURES
= %w(flowers
.jpg example
.log
)
15 FIXTURES
.each
do |filename
|
16 data = File
.read(ASSETS_ROOT
+ "/#{filename}")
17 data.force_encoding('ASCII-8BIT') if data.respond_to
?(:force_encoding)
20 bin
= Binary
.new(:data => data)
21 assert_equal
data, bin
.data, 'Newly assigned data differs from original'
24 assert_equal
data, bin
.data, 'Data differs from original after save'
26 assert_equal
data, bin
.reload
.data, 'Reloaded data differs from original'