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


150
151
152
# File 'lib/matchers/associations/associations.rb', line 150

def belong_to association_name
  HaveAssociationMatcher.new association_name, BELONGS_TO
end

#embed_many(association_name) ⇒ Object


158
159
160
# File 'lib/matchers/associations/associations.rb', line 158

def embed_many association_name
  HaveAssociationMatcher.new association_name, EMBEDS_MANY
end

#embed_one(association_name) ⇒ Object


154
155
156
# File 'lib/matchers/associations/associations.rb', line 154

def embed_one association_name
  HaveAssociationMatcher.new association_name, EMBEDS_ONE
end

#embedded_in(association_name) ⇒ Object


162
163
164
# File 'lib/matchers/associations/associations.rb', line 162

def embedded_in association_name
  HaveAssociationMatcher.new association_name, EMBEDDED_IN
end

#have_and_belong_to_many(association_name) ⇒ Object


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

def have_and_belong_to_many association_name
  HaveAssociationMatcher.new association_name, HAS_AND_BELONGS_TO_MANY
end

#have_many(association_name) ⇒ Object


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

def have_many association_name
  HaveAssociationMatcher.new association_name, HAS_MANY
end

#have_one(association_name) ⇒ Object


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

def have_one association_name
  HaveAssociationMatcher.new association_name, HAS_ONE
end