Module: Mongoid::Matchers::Associations
- Included in:
- Mongoid::Matchers
- Defined in:
- lib/matchers/associations.rb
Defined Under Namespace
Classes: HaveAssociationMatcher
Constant Summary collapse
- HAS_MANY =
Mongoid::Relations::Referenced::Many
- HAS_AND_BELONGS_TO_MANY =
Mongoid::Relations::Referenced::ManyToMany
- HAS_ONE =
Mongoid::Relations::Referenced::One
- BELONGS_TO =
Mongoid::Relations::Referenced::In
- EMBEDS_MANY =
Mongoid::Relations::Embedded::Many
- EMBEDS_ONE =
Mongoid::Relations::Embedded::One
- EMBEDDED_IN =
Mongoid::Relations::Embedded::In
Instance Method Summary collapse
- #be_embedded_in(association_name) ⇒ Object
- #belong_to_related(association_name) ⇒ Object (also: #be_referenced_in, #belong_to)
- #embed_many(association_name) ⇒ Object
- #embed_one(association_name) ⇒ Object
- #have_and_belong_to_many(association_name) ⇒ Object (also: #reference_and_be_referenced_in_many)
- #have_many_related(association_name) ⇒ Object (also: #reference_many, #have_many)
- #have_one_related(association_name) ⇒ Object (also: #reference_one, #have_one)
Instance Method Details
#be_embedded_in(association_name) ⇒ Object
123 124 125 |
# File 'lib/matchers/associations.rb', line 123 def (association_name) HaveAssociationMatcher.new(association_name, EMBEDDED_IN) end |
#belong_to_related(association_name) ⇒ Object Also known as: be_referenced_in, belong_to
144 145 146 |
# File 'lib/matchers/associations.rb', line 144 def (association_name) HaveAssociationMatcher.new(association_name, BELONGS_TO) end |
#embed_many(association_name) ⇒ Object
119 120 121 |
# File 'lib/matchers/associations.rb', line 119 def (association_name) HaveAssociationMatcher.new(association_name, EMBEDS_MANY) end |
#embed_one(association_name) ⇒ Object
115 116 117 |
# File 'lib/matchers/associations.rb', line 115 def (association_name) HaveAssociationMatcher.new(association_name, EMBEDS_ONE) end |
#have_and_belong_to_many(association_name) ⇒ Object Also known as: reference_and_be_referenced_in_many
139 140 141 |
# File 'lib/matchers/associations.rb', line 139 def have_and_belong_to_many(association_name) HaveAssociationMatcher.new(association_name, HAS_AND_BELONGS_TO_MANY) end |
#have_many_related(association_name) ⇒ Object Also known as: reference_many, have_many
133 134 135 |
# File 'lib/matchers/associations.rb', line 133 def (association_name) HaveAssociationMatcher.new(association_name, HAS_MANY) end |
#have_one_related(association_name) ⇒ Object Also known as: reference_one, have_one
127 128 129 |
# File 'lib/matchers/associations.rb', line 127 def (association_name) HaveAssociationMatcher.new(association_name, HAS_ONE) end |