Sha256: 4e36d0c50d6cb16763f06d024e39b60d14c38307b23027457a4f702308bf72fb

Contents?: true

Size: 1.09 KB

Versions: 84

Compression:

Stored size: 1.09 KB

Contents

require 'abstract_unit'
require 'fixtures/binary'

class BinaryTest < Test::Unit::TestCase
  BINARY_FIXTURE_PATH = File.dirname(__FILE__) + '/fixtures/flowers.jpg'

  def setup
    Binary.connection.execute 'DELETE FROM binaries'
    @data = File.read(BINARY_FIXTURE_PATH).freeze
  end
  
  def test_truth
    assert true
  end

  # Without using prepared statements, it makes no sense to test
  # BLOB data with SQL Server, because the length of a statement is
  # limited to 8KB.
  #
  # Without using prepared statements, it makes no sense to test
  # BLOB data with DB2 or Firebird, because the length of a statement
  # is limited to 32KB.
  unless %w(SQLServer Sybase DB2 Oracle Firebird).include? ActiveRecord::Base.connection.adapter_name
    def test_load_save
      bin = Binary.new
      bin.data = @data

      assert @data == bin.data, 'Newly assigned data differs from original'
          
      bin.save
      assert @data == bin.data, 'Data differs from original after save'

      db_bin = Binary.find(bin.id)
      assert @data == db_bin.data, 'Reloaded data differs from original'
    end
  end
end

Version data entries

84 entries across 84 versions & 6 rubygems

Version Path
jstorimer-deep-test-2.0.0 sample_rails_project/vendor/rails/activerecord/test/binary_test.rb
jstorimer-deep-test-1.4.0 sample_rails_project/vendor/rails/activerecord/test/binary_test.rb
jstorimer-deep-test-1.3.0 sample_rails_project/vendor/rails/activerecord/test/binary_test.rb
jstorimer-deep-test-1.2.0 sample_rails_project/vendor/rails/activerecord/test/binary_test.rb
jstorimer-deep-test-1.1.0 sample_rails_project/vendor/rails/activerecord/test/binary_test.rb
jstorimer-deep-test-1.0.0 sample_rails_project/vendor/rails/activerecord/test/binary_test.rb
jstorimer-deep-test-0.2.0 sample_rails_project/vendor/rails/activerecord/test/binary_test.rb
jstorimer-deep-test-0.1.0 sample_rails_project/vendor/rails/activerecord/test/binary_test.rb
activerecord-1.14.1 test/binary_test.rb
activerecord-1.14.0 test/binary_test.rb
activerecord-1.14.2 test/binary_test.rb
activerecord-1.14.3 test/binary_test.rb
activerecord-1.15.2 test/binary_test.rb
activerecord-1.14.4 test/binary_test.rb
activerecord-1.15.0 test/binary_test.rb
activerecord-1.15.1 test/binary_test.rb
activerecord-1.15.3 test/binary_test.rb
activerecord-1.15.4 test/binary_test.rb
activerecord-1.15.6 test/binary_test.rb
activerecord-1.15.5 test/binary_test.rb