Sha256: 51e7fbd8f7bdf38f0b1555788d16b3b5d35e6412dc8ac0eaf594f5355dd859bf

Contents?: true

Size: 438 Bytes

Versions: 23

Compression:

Stored size: 438 Bytes

Contents

require 'test_helper'

class BinaryTest < Test::Unit::TestCase  
  should "serialize and deserialize correctly" do
    klass = Class.new do
      include MongoMapper::Document
      set_collection_name 'test'
      key :contents, Binary
    end
    klass.collection.clear
    
    doc = klass.new(:contents => '010101')
    doc.save
    
    doc = klass.find(doc.id)
    doc.contents.to_s.should == ByteBuffer.new('010101').to_s
  end
end

Version data entries

23 entries across 23 versions & 3 rubygems

Version Path
djsun-mongo_mapper-0.5.0.1 test/functional/test_binary.rb
mongo_mapper-0.5.1 test/functional/test_binary.rb
mongo_mapper-0.5.0 test/functional/test_binary.rb