Sha256: b6fbb2f681c13a2912f285b5994bb1ef569c27facf45d9d853b1033dd6a0a4ca

Contents?: true

Size: 720 Bytes

Versions: 7

Compression:

Stored size: 720 Bytes

Contents

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

describe Mongoid::Associations::BelongsToAssociation do

  before do
    @parent = Name.new(:first_name => "Drexel")
    @document = stub(:parent => @parent)
  end

  describe "#method_missing" do

    before do
      @association = Mongoid::Associations::BelongsToAssociation.new(@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

7 entries across 7 versions & 2 rubygems

Version Path
durran-mongoid-0.2.0 spec/unit/mongoid/associations/belongs_to_association_spec.rb
durran-mongoid-0.2.2 spec/unit/mongoid/associations/belongs_to_association_spec.rb
durran-mongoid-0.2.3 spec/unit/mongoid/associations/belongs_to_association_spec.rb
durran-mongoid-0.2.4 spec/unit/mongoid/associations/belongs_to_association_spec.rb
mongoid-0.2.7 spec/unit/mongoid/associations/belongs_to_association_spec.rb
mongoid-0.2.6 spec/unit/mongoid/associations/belongs_to_association_spec.rb
mongoid-0.2.5 spec/unit/mongoid/associations/belongs_to_association_spec.rb