Sha256: 963f97bdc0980a3cfe6ffae67d33cf4332ac595f1435c5a9077f76ee650f835e

Contents?: true

Size: 739 Bytes

Versions: 16

Compression:

Stored size: 739 Bytes

Contents

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

describe Mongoid::Associations::HasOneAssociation do

  before do
    @attributes = { :name => { :first_name => "Drexel" } }
    @document = stub(:attributes => @attributes)
  end

  describe "#method_missing" do

    before do
      @association = Mongoid::Associations::HasOneAssociation.new(:name, @document)
    end

    context "when getting values" do

      it "delegates to the document" do
        @association.first_name.should == "Drexel"
      end

    end

    context "when setting values" do

      it "delegates to the document" do
        @association.first_name = "Test"
        @association.first_name.should == "Test"
      end

    end

  end

end

Version data entries

16 entries across 16 versions & 2 rubygems

Version Path
durran-mongoid-0.2.0 spec/unit/mongoid/associations/has_one_association_spec.rb
durran-mongoid-0.2.2 spec/unit/mongoid/associations/has_one_association_spec.rb
durran-mongoid-0.2.3 spec/unit/mongoid/associations/has_one_association_spec.rb
durran-mongoid-0.2.4 spec/unit/mongoid/associations/has_one_association_spec.rb
mongoid-0.4.3 spec/unit/mongoid/associations/has_one_association_spec.rb
mongoid-0.4.2 spec/unit/mongoid/associations/has_one_association_spec.rb
mongoid-0.4.1 spec/unit/mongoid/associations/has_one_association_spec.rb
mongoid-0.4.0 spec/unit/mongoid/associations/has_one_association_spec.rb
mongoid-0.3.4 spec/unit/mongoid/associations/has_one_association_spec.rb
mongoid-0.3.3 spec/unit/mongoid/associations/has_one_association_spec.rb
mongoid-0.3.2 spec/unit/mongoid/associations/has_one_association_spec.rb
mongoid-0.3.1 spec/unit/mongoid/associations/has_one_association_spec.rb
mongoid-0.3.0 spec/unit/mongoid/associations/has_one_association_spec.rb
mongoid-0.2.7 spec/unit/mongoid/associations/has_one_association_spec.rb
mongoid-0.2.6 spec/unit/mongoid/associations/has_one_association_spec.rb
mongoid-0.2.5 spec/unit/mongoid/associations/has_one_association_spec.rb