Sha256: c8819e858c95b2278e5f3091d721ebc9246b5a20e74916192792a7c072646f0c

Contents?: true

Size: 853 Bytes

Versions: 11

Compression:

Stored size: 853 Bytes

Contents

require 'spec_helper'

module BelongsToAssociation
  include MongoMapper::Plugins::Associations
  describe "BelongsToAssociation" do

    context "class_name" do
      it "should camelize the name" do
        BelongsToAssociation.new(:user).class_name.should == 'User'
      end

      it "should be changeable using class_name option" do
        association = BelongsToAssociation.new(:user, :class_name => 'Person')
        association.class_name.should == 'Person'
      end
    end

    context "embeddable?" do
      it "should be false even if class is embeddable" do
        base = BelongsToAssociation.new(:address)
        base.embeddable?.should be_falsey
      end

      it "should be false if class is not embeddable" do
        base = BelongsToAssociation.new(:project)
        base.embeddable?.should be_falsey
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
mongo_mapper-0.17.0 spec/unit/associations/belongs_to_association_spec.rb
mongo_mapper-0.16.0 spec/unit/associations/belongs_to_association_spec.rb
mongo_mapper-0.15.6 spec/unit/associations/belongs_to_association_spec.rb
mongo_mapper-0.15.5 spec/unit/associations/belongs_to_association_spec.rb
mongo_mapper-0.15.4 spec/unit/associations/belongs_to_association_spec.rb
mongo_mapper-0.15.3 spec/unit/associations/belongs_to_association_spec.rb
mongo_mapper-0.15.2 spec/unit/associations/belongs_to_association_spec.rb
mongo_mapper-0.15.1 spec/unit/associations/belongs_to_association_spec.rb
mongo_mapper-0.15.0 spec/unit/associations/belongs_to_association_spec.rb
mongo_mapper-0.14.0 spec/unit/associations/belongs_to_association_spec.rb
mongo_mapper-0.14.0.rc1 spec/unit/associations/belongs_to_association_spec.rb