Sha256: 20af3344dc2b79d162ed2f497de2cb0a300062263ded9303ea5e6acaba102211

Contents?: true

Size: 793 Bytes

Versions: 30

Compression:

Stored size: 793 Bytes

Contents

require File.expand_path(File.join(File.dirname(__FILE__), "/../../../../spec_helper.rb"))

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 }),
          HashWithIndifferentAccess.new({ :_id => 2, :title => "Madam", :age => 100 }) ]
    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

30 entries across 30 versions & 1 rubygems

Version Path
mongoid-0.7.3 spec/unit/mongoid/extensions/array/conversions_spec.rb
mongoid-0.7.2 spec/unit/mongoid/extensions/array/conversions_spec.rb
mongoid-0.7.1 spec/unit/mongoid/extensions/array/conversions_spec.rb
mongoid-0.7.0 spec/unit/mongoid/extensions/array/conversions_spec.rb
mongoid-0.6.10 spec/unit/mongoid/extensions/array/conversions_spec.rb
mongoid-0.6.9 spec/unit/mongoid/extensions/array/conversions_spec.rb
mongoid-0.6.8 spec/unit/mongoid/extensions/array/conversions_spec.rb
mongoid-0.6.7 spec/unit/mongoid/extensions/array/conversions_spec.rb
mongoid-0.6.6 spec/unit/mongoid/extensions/array/conversions_spec.rb
mongoid-0.6.5 spec/unit/mongoid/extensions/array/conversions_spec.rb