Module: Mongoid::Matchers::Associations

Included in:
Mongoid::Matchers
Defined in:
lib/matchers/associations.rb

Defined Under Namespace

Classes: HaveAssociationMatcher

Constant Summary

HAS_MANY =
defined?(Mongoid::Associations::HasManyRelated) ? Mongoid::Associations::HasManyRelated : Mongoid::Associations::ReferencesMany
HAS_MANY_AS_ARRAY =
Mongoid::Associations::ReferencesManyAsArray
HAS_ONE =
defined?(Mongoid::Associations::HasOneRelated) ? Mongoid::Associations::HasOneRelated : Mongoid::Associations::ReferencesOne
BELONGS_TO =
defined?(Mongoid::Associations::BelongsToRelated) ? Mongoid::Associations::BelongsToRelated : Mongoid::Associations::ReferencedIn
EMBEDS_MANY =
Mongoid::Associations::EmbedsMany
EMBEDS_ONE =
Mongoid::Associations::EmbedsOne
EMBEDDED_IN =
Mongoid::Associations::EmbeddedIn

Instance Method Summary (collapse)

Instance Method Details

- (Object) be_embedded_in(association_name)



127
128
129
# File 'lib/matchers/associations.rb', line 127

def be_embedded_in(association_name)
  HaveAssociationMatcher.new(association_name, EMBEDDED_IN)
end


141
142
143
# File 'lib/matchers/associations.rb', line 141

def belong_to_related(association_name)
  HaveAssociationMatcher.new(association_name, BELONGS_TO)
end

- (Object) embed_many(association_name)



123
124
125
# File 'lib/matchers/associations.rb', line 123

def embed_many(association_name)
  HaveAssociationMatcher.new(association_name, EMBEDS_MANY)
end

- (Object) embed_one(association_name)



119
120
121
# File 'lib/matchers/associations.rb', line 119

def embed_one(association_name)
  HaveAssociationMatcher.new(association_name, EMBEDS_ONE)
end


136
137
138
# File 'lib/matchers/associations.rb', line 136

def have_many_related(association_name)
  HaveAssociationMatcher.new(association_name, HAS_MANY)
end


131
132
133
# File 'lib/matchers/associations.rb', line 131

def have_one_related(association_name)
  HaveAssociationMatcher.new(association_name, HAS_ONE)
end