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-0.7.3 test/functional/test_binary.rb
numon-0.0.1 test/functional/test_binary.rb
mongo_mapper-0.7.2 test/functional/test_binary.rb
mongo_mapper-0.7.1 test/functional/test_binary.rb
mongo_mapper-unstable-2010.3.8 test/functional/test_binary.rb
mongo_mapper-unstable-2010.3.5 test/functional/test_binary.rb
mongo_mapper-unstable-2010.3.4 test/functional/test_binary.rb
mongo_mapper-unstable-2010.3.3 test/functional/test_binary.rb
drogus-mongo_mapper-0.6.10 test/functional/test_binary.rb
mongo_mapper-rails3-0.7.0.1 test/functional/test_binary.rb
mongo_mapper-unstable-2010.2.28 test/functional/test_binary.rb
mongo_mapper-unstable-2010.2.27 test/functional/test_binary.rb
mongo_mapper-unstable-2010.2.26 test/functional/test_binary.rb
mongo_mapper-unstable-2010.2.25 test/functional/test_binary.rb
mongo_mapper-unstable-2010.2.24 test/functional/test_binary.rb
mongo_mapper-unstable-2010.2.23 test/functional/test_binary.rb
mongo_mapper-unstable-2010.2.22 test/functional/test_binary.rb
mongo_mapper-unstable-2010.2.19 test/functional/test_binary.rb
mongo_mapper-unstable-2010.2.18 test/functional/test_binary.rb
mongo_mapper-unstable-2010.2.17 test/functional/test_binary.rb