Sha256: 7fddb08ed8fa14c7b1f2faf77e10bb239441504e966d8deb50c668bd563822df

Contents?: true

Size: 552 Bytes

Versions: 6

Compression:

Stored size: 552 Bytes

Contents

require 'spec_helper'

describe "Binary" do
  it "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
    before do
      @document = Doc do
        key :file, Binary
      end
    end

    it "not fail" do
      expect { @document.new(:file => nil).save }.to_not raise_error
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
mongo_mapper-0.14.0 spec/functional/binary_spec.rb
mongo_mapper-0.14.0.rc1 spec/functional/binary_spec.rb
mongo_mapper-0.13.1 spec/functional/binary_spec.rb
mongo_mapper-0.13.0 spec/functional/binary_spec.rb
mongo_mapper-0.13.0.beta2 spec/functional/binary_spec.rb
mongo_mapper-0.13.0.beta1 spec/functional/binary_spec.rb