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.1.27 test/functional/test_binary.rb
mongo_mapper-unstable-2010.1.26 test/functional/test_binary.rb
mongo_mapper-unstable-2010.1.25 test/functional/test_binary.rb
mongo_mapper-unstable-2010.1.22 test/functional/test_binary.rb
mongo_mapper-unstable-2010.1.21 test/functional/test_binary.rb
mongo_mapper-unstable-2010.1.20 test/functional/test_binary.rb
mongo_mapper-unstable-2010.1.19 test/functional/test_binary.rb
jmonteiro-mongo_mapper-0.1.7 test/functional/test_binary.rb
mongo_mapper-unstable-2010.1.18 test/functional/test_binary.rb
jmonteiro-mongo_mapper-0.1.6 test/functional/test_binary.rb
jmonteiro-mongo_mapper-0.1.5 test/functional/test_binary.rb
mongo_mapper-unstable-2010.1.17 test/functional/test_binary.rb
jmonteiro-mongo_mapper-0.1.4 test/functional/test_binary.rb
jmonteiro-mongo_mapper-0.1.2 test/functional/test_binary.rb
jmonteiro-mongo_mapper-0.1.1 test/functional/test_binary.rb
jmonteiro-mongo_mapper-0.1.0 test/functional/test_binary.rb
mongo_mapper-unstable-2010.1.12 test/functional/test_binary.rb
mrkurt-mongo_mapper-0.6.11 test/functional/test_binary.rb
mongo_mapper-unstable-2010.1.6 test/functional/test_binary.rb
mongo_mapper-unstable-2010.1.5 test/functional/test_binary.rb