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.9.2 spec/unit/mongoid/extensions/array/conversions_spec.rb
mongoid-0.9.1 spec/unit/mongoid/extensions/array/conversions_spec.rb
mongoid-0.9.0 spec/unit/mongoid/extensions/array/conversions_spec.rb
mongoid-0.8.10 spec/unit/mongoid/extensions/array/conversions_spec.rb
mongoid-0.8.9 spec/unit/mongoid/extensions/array/conversions_spec.rb
mongoid-0.8.8 spec/unit/mongoid/extensions/array/conversions_spec.rb
mongoid-0.8.7 spec/unit/mongoid/extensions/array/conversions_spec.rb
mongoid-0.8.6 spec/unit/mongoid/extensions/array/conversions_spec.rb
mongoid-0.8.5 spec/unit/mongoid/extensions/array/conversions_spec.rb
mongoid-0.8.4 spec/unit/mongoid/extensions/array/conversions_spec.rb
mongoid-0.8.3 spec/unit/mongoid/extensions/array/conversions_spec.rb
mongoid-0.8.2 spec/unit/mongoid/extensions/array/conversions_spec.rb
mongoid-0.8.1 spec/unit/mongoid/extensions/array/conversions_spec.rb
mongoid-0.7.10 spec/unit/mongoid/extensions/array/conversions_spec.rb
mongoid-0.7.9 spec/unit/mongoid/extensions/array/conversions_spec.rb
mongoid-0.7.8 spec/unit/mongoid/extensions/array/conversions_spec.rb
mongoid-0.7.7 spec/unit/mongoid/extensions/array/conversions_spec.rb
mongoid-0.7.6 spec/unit/mongoid/extensions/array/conversions_spec.rb
mongoid-0.7.5 spec/unit/mongoid/extensions/array/conversions_spec.rb
mongoid-0.7.4 spec/unit/mongoid/extensions/array/conversions_spec.rb