Module: Mongoid::Matchers::Associations

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

Defined Under Namespace

Classes: HaveAssociationMatcher

Constant Summary collapse

HAS_ONE =
Mongoid::Relations::Referenced::One
HAS_MANY =
Mongoid::Relations::Referenced::Many
HAS_AND_BELONGS_TO_MANY =
Mongoid::Relations::Referenced::ManyToMany
BELONGS_TO =
Mongoid::Relations::Referenced::In
EMBEDS_ONE =
Mongoid::Relations::Embedded::One
EMBEDS_MANY =
Mongoid::Relations::Embedded::Many
EMBEDDED_IN =
Mongoid::Relations::Embedded::In

Instance Method Summary collapse

Instance Method Details

#belong_to(association_name) ⇒ Object



134
135
136
# File 'lib/matchers/associations/associations.rb', line 134

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

#embed_many(association_name) ⇒ Object



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

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

#embed_one(association_name) ⇒ Object



138
139
140
# File 'lib/matchers/associations/associations.rb', line 138

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

#embedded_in(association_name) ⇒ Object



146
147
148
# File 'lib/matchers/associations/associations.rb', line 146

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

#have_and_belong_to_many(association_name) ⇒ Object



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

def have_and_belong_to_many(association_name)
  HaveAssociationMatcher.new(association_name, HAS_AND_BELONGS_TO_MANY)
end

#have_many(association_name) ⇒ Object



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

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

#have_one(association_name) ⇒ Object



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

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