Sha256: d0c58d3de9d8e88966bb0ffb8cfc43a660a4e1ce30613b3548e7b12da5638cd2

Contents?: true

Size: 567 Bytes

Versions: 17

Compression:

Stored size: 567 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::Binary.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

17 entries across 17 versions & 6 rubygems

Version Path
mongo_mapper-0.12.0 test/functional/test_binary.rb
lookout-mongo_mapper-0.11.3 test/functional/test_binary.rb
mongo_mapper-0.11.2 test/functional/test_binary.rb
jamieorc-mongo_mapper-0.11.1.1 test/functional/test_binary.rb
mongo_mapper-0.11.1 test/functional/test_binary.rb
mongo_mapper-0.11.0 test/functional/test_binary.rb
mongo_mapper-0.10.1 test/functional/test_binary.rb
mongo_mapper-0.10.0 test/functional/test_binary.rb
mongo_mapper-0.9.2 test/functional/test_binary.rb
jonbell-mongo_mapper-0.8.6 test/functional/test_binary.rb
mongo_mapper-0.9.1 test/functional/test_binary.rb
mongo_mapper-0.9.0 test/functional/test_binary.rb
ign-mongo_mapper-0.8.6.2 test/functional/test_binary.rb
ign-mongo_mapper-0.8.6.1 test/functional/test_binary.rb
ssherman-mongo_mapper-0.8.6 test/functional/test_binary.rb
mongo_mapper-0.8.6 test/functional/test_binary.rb
mongo_mapper-0.8.5 test/functional/test_binary.rb