Sha256: 0f5364f37c4885ea20f60dfb225e5129626901d20816230fd2fb2caf384ca31e

Contents?: true

Size: 577 Bytes

Versions: 63

Compression:

Stored size: 577 Bytes

Contents

require 'test_helper'

class BinaryTest < Test::Unit::TestCase  
  should "serialize and deserialize correctly" do
    klass = Doc do
      key :contents, Binary
    end
    
    doc = klass.new(:contents => '010101')
    doc.save
    
    doc = doc.reload
    doc.contents.to_s.should == ByteBuffer.new('010101').to_s
  end
  
  context "Saving a document with a blank binary value" do
    setup do
      @document = Doc do
        key :file, Binary
      end
    end

    should "not fail" do
      assert_nothing_raised { @document.new(:file => nil).save }
    end
  end
end

Version data entries

63 entries across 63 versions & 9 rubygems

Version Path
mongo_mapper-unstable-2010.2.16 test/functional/test_binary.rb
mongo_mapper-unstable-2010.2.15 test/functional/test_binary.rb
mongo_mapper-unstable-2010.2.12 test/functional/test_binary.rb
mongo_mapper-unstable-2010.2.11 test/functional/test_binary.rb
mongo_mapper-unstable-2010.2.10 test/functional/test_binary.rb
mongo_mapper-0.7.0 test/functional/test_binary.rb
mongo_mapper-unstable-2010.2.9 test/functional/test_binary.rb
mongo_mapper-unstable-2010.2.8 test/functional/test_binary.rb
mongo_mapper-unstable-2010.2.5 test/functional/test_binary.rb
mongo_mapper-unstable-2010.2.4 test/functional/test_binary.rb
novelys_mongo_mapper-0.6.12 test/functional/test_binary.rb
novelys_mongo_mapper-0.6.11 test/functional/test_binary.rb
mongo_mapper-unstable-2010.2.3 test/functional/test_binary.rb
novelys_mongo_mapper-0.6.10 test/functional/test_binary.rb
mongo_mapper-unstable-2010.2.2 test/functional/test_binary.rb
mongo_mapper-unstable-2010.2.1 test/functional/test_binary.rb
mongo_mapper-unstable-2010.1.31 test/functional/test_binary.rb
mongo_mapper-unstable-2010.1.30 test/functional/test_binary.rb
mongo_mapper-unstable-2010.1.29 test/functional/test_binary.rb
mongo_mapper-unstable-2010.1.28 test/functional/test_binary.rb