| 4 | | class BinaryTest < Test::Unit::TestCase |
|---|
| 5 | | BINARY_FIXTURE_PATH = File.dirname(__FILE__) + '/fixtures/flowers.jpg' |
|---|
| | 3 | # Without using prepared statements, it makes no sense to test |
|---|
| | 4 | # BLOB data with SQL Server, because the length of a statement is |
|---|
| | 5 | # limited to 8KB. |
|---|
| | 6 | # |
|---|
| | 7 | # Without using prepared statements, it makes no sense to test |
|---|
| | 8 | # BLOB data with DB2 or Firebird, because the length of a statement |
|---|
| | 9 | # is limited to 32KB. |
|---|
| | 10 | unless current_adapter?(:SQLServerAdapter, :SybaseAdapter, :DB2Adapter, :FirebirdAdapter) |
|---|
| | 11 | require 'fixtures/binary' |
|---|
| 16 | | # Without using prepared statements, it makes no sense to test |
|---|
| 17 | | # BLOB data with SQL Server, because the length of a statement is |
|---|
| 18 | | # limited to 8KB. |
|---|
| 19 | | # |
|---|
| 20 | | # Without using prepared statements, it makes no sense to test |
|---|
| 21 | | # BLOB data with DB2 or Firebird, because the length of a statement |
|---|
| 22 | | # is limited to 32KB. |
|---|
| 23 | | unless current_adapter?(:SQLServerAdapter, :SybaseAdapter, :DB2Adapter, :FirebirdAdapter) |
|---|
| 33 | | db_bin = Binary.find(bin.id) |
|---|
| 34 | | assert @data == db_bin.data, 'Reloaded data differs from original' |
|---|
| | 22 | bin = Binary.new(:data => data) |
|---|
| | 23 | assert_equal data, bin.data, 'Newly assigned data differs from original' |
|---|
| | 24 | |
|---|
| | 25 | bin.save! |
|---|
| | 26 | assert_equal data, bin.data, 'Data differs from original after save' |
|---|
| | 27 | |
|---|
| | 28 | assert_equal data, bin.reload.data, 'Reloaded data differs from original' |
|---|
| | 29 | end |
|---|