Sha256: 874ab47ed014f4ee14b6588c986329f88235f2d218f208490252faccb81ccbd0

Contents?: true

Size: 828 Bytes

Versions: 12

Compression:

Stored size: 828 Bytes

Contents

require "spec_helper"

describe Mongoid::Extensions::Array::Conversions do

  describe "#mongoidize" do

    it "collects each of its attributes" do
      array = [
        Person.new(:_id => 1, :title => "Sir"),
        Person.new(:_id => 2, :title => "Madam")
      ]
      array.mongoidize.should ==
        [ HashWithIndifferentAccess.new({ :_id => 1, :title => "Sir", :age => 100, :_type => "Person", "blood_alcohol_content" => 0.0 }),
          HashWithIndifferentAccess.new({ :_id => 2, :title => "Madam", :age => 100, :_type => "Person", "blood_alcohol_content" => 0.0 }) ]
    end

  end

  describe "#get" do

    it "returns the array" do
      Array.get(["test"]).should == ["test"]
    end

  end

  describe "#set" do

    it "returns the array" do
      Array.set(["test"]).should == ["test"]
    end

  end

end

Version data entries

12 entries across 12 versions & 2 rubygems

Version Path
mongoid-pre-2.0.0.pre spec/unit/mongoid/extensions/array/conversions_spec.rb
mongoid-1.2.6 spec/unit/mongoid/extensions/array/conversions_spec.rb
mongoid-1.2.5 spec/unit/mongoid/extensions/array/conversions_spec.rb
mongoid-1.2.4 spec/unit/mongoid/extensions/array/conversions_spec.rb
mongoid-1.2.3 spec/unit/mongoid/extensions/array/conversions_spec.rb
mongoid-1.2.2 spec/unit/mongoid/extensions/array/conversions_spec.rb
mongoid-1.2.1 spec/unit/mongoid/extensions/array/conversions_spec.rb
mongoid-1.2.0 spec/unit/mongoid/extensions/array/conversions_spec.rb
mongoid-1.1.4 spec/unit/mongoid/extensions/array/conversions_spec.rb
mongoid-1.1.3 spec/unit/mongoid/extensions/array/conversions_spec.rb
mongoid-1.1.2 spec/unit/mongoid/extensions/array/conversions_spec.rb
mongoid-1.1.1 spec/unit/mongoid/extensions/array/conversions_spec.rb