Module: RSpecExtensionsCollection::Matchers
- Defined in:
- lib/rspec_extensions_collection/matchers/search_matcher.rb,
lib/rspec_extensions_collection/helpers/mongoid_model_helpers.rb,
lib/rspec_extensions_collection/matchers/search_embedded_matcher.rb
Defined Under Namespace
Modules: MongoidModelHelpers Classes: SearchEmbeddedMatcher, SearchMatcher
Instance Method Summary collapse
-
#search_by(*args) ⇒ Object
Asserts the search is made with the given fields with the option specifying if the result if filtered by locale.
-
#search_embedded_by(association_name, *args) ⇒ Object
Asserts the search is made with the given fields for embedded Mongoid document with the option specifying if the result if filtered by locale.
Instance Method Details
#search_by(*args) ⇒ Object
Asserts the search is made with the given fields with the option specifying if the result if filtered by locale. The method to test: search(keyword)
Options:
args: List of field name symbols.
Last argument can be +Hash+ of options.
:locale - Specifies the locale on which the filtering the search result is based on. "en" or "fr".
Example:
BlogPost.should search_by(:title, :content, :locale => I18n.locale.to_s)
16 17 18 |
# File 'lib/rspec_extensions_collection/matchers/search_matcher.rb', line 16 def search_by(*args) SearchMatcher.new(*args) end |
#search_embedded_by(association_name, *args) ⇒ Object
Asserts the search is made with the given fields for embedded Mongoid document with the option specifying if the result if filtered by locale. The method to test: search_embedded(keyword)
Options:
association_name: Name of the embedded document specified in the parent document. args: List of field name symbols.
Last argument can be +Hash+ of options.
:locale - Specifies the locale on which the filtering the search result is based on. "en" or "fr".
Example:
BlogPost.should search_embedded_by(:comments, :title, :content, :locale => I18n.locale.to_s)
20 21 22 |
# File 'lib/rspec_extensions_collection/matchers/search_embedded_matcher.rb', line 20 def (association_name, *args) SearchEmbeddedMatcher.new(association_name, *args) end |