Sha256: b6306da870c9d3575348de067c1cf14e0d692a4592031b59862818386d9c8548

Contents?: true

Size: 757 Bytes

Versions: 7

Compression:

Stored size: 757 Bytes

Contents

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

describe Mongoid::Associations::HasOneAssociation do

  before do
    @attributes = { :mixed_drink => { :name => "Jack and Coke" } }
    @document = stub(:attributes => @attributes)
  end

  describe "#decorate!" do

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

    context "when getting values" do

      it "delegates to the document" do
        @association.name.should == "Jack and Coke"
      end

    end

    context "when setting values" do

      it "delegates to the document" do
        @association.name = "Jack and Coke"
        @association.name.should == "Jack and Coke"
      end

    end

  end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
mongoid-0.6.1 spec/unit/mongoid/associations/has_one_association_spec.rb
mongoid-0.6.0 spec/unit/mongoid/associations/has_one_association_spec.rb
mongoid-0.5.11 spec/unit/mongoid/associations/has_one_association_spec.rb
mongoid-0.5.10 spec/unit/mongoid/associations/has_one_association_spec.rb
mongoid-0.5.9 spec/unit/mongoid/associations/has_one_association_spec.rb
mongoid-0.5.8 spec/unit/mongoid/associations/has_one_association_spec.rb
mongoid-0.5.7 spec/unit/mongoid/associations/has_one_association_spec.rb