Sha256: dd75384e0a5f9850f17f274841607f7f4a0132ac28941b9cd8799a06428ff9d8

Contents?: true

Size: 571 Bytes

Versions: 55

Compression:

Stored size: 571 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 == BSON::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

55 entries across 55 versions & 5 rubygems

Version Path
honkster-mongo_mapper-0.8.4 test/functional/test_binary.rb
mongo_mapper-0.8.4 test/functional/test_binary.rb
mongo_mapper-unstable-2010.08.19 test/functional/test_binary.rb
mongo_mapper-unstable-2010.08.18 test/functional/test_binary.rb
mongo_mapper-unstable-2010.08.17 test/functional/test_binary.rb
mongo_mapper-unstable-2010.08.16 test/functional/test_binary.rb
mongo_mapper-unstable-2010.08.15 test/functional/test_binary.rb
mongo_mapper-unstable-2010.08.14 test/functional/test_binary.rb
mongo_mapper-unstable-2010.08.13 test/functional/test_binary.rb
mongo_mapper-unstable-2010.08.12 test/functional/test_binary.rb
mongo_mapper-unstable-2010.08.11 test/functional/test_binary.rb
mongo_mapper-unstable-2010.08.10 test/functional/test_binary.rb
mongo_mapper-unstable-2010.08.09 test/functional/test_binary.rb
mongo_mapper-0.8.3 test/functional/test_binary.rb
mongo_mapper-unstable-2010.08.08 test/functional/test_binary.rb
mongo_mapper-unstable-2010.08.06 test/functional/test_binary.rb
mongo_mapper-unstable-2010.08.05 test/functional/test_binary.rb
mongo_mapper-unstable-2010.08.04 test/functional/test_binary.rb
mongo_mapper-unstable-2010.08.03 test/functional/test_binary.rb
mongo_mapper-unstable-2010.08.02 test/functional/test_binary.rb