Sha256: 331936b6bfd576f91bfbefa6e5b60fa2dd497b024e0cbcf46078e0cf50afb289

Contents?: true

Size: 439 Bytes

Versions: 7

Compression:

Stored size: 439 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.remove
    
    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

7 entries across 7 versions & 3 rubygems

Version Path
mongo_mapper-unstable-2009.11.8 test/functional/test_binary.rb
mongo_mapper-unstable-2009.11.6 test/functional/test_binary.rb
djsun-mongo_mapper-0.5.8.2 test/functional/test_binary.rb
djsun-mongo_mapper-0.5.8.1 test/functional/test_binary.rb
mongo_mapper-unstable-2009.11.2 test/functional/test_binary.rb
mongo_mapper-unstable-2009.10.31 test/functional/test_binary.rb
mongo_mapper-0.5.8 test/functional/test_binary.rb