Sha256: a4b038f865e75a691d896df2b12b668f2014858bce2e7c7eae22e18f65fe0f00
Contents?: true
Size: 1.65 KB
Versions: 1
Compression:
Stored size: 1.65 KB
Contents
= RSpec extensions collection This is a collection of various RSpec extensions I would like to use for multiple projects. The primary purpose is for me to use them anywhere so it's not necessarily made for generic use. == Install Put the following in Gemfile: gem "rspec_extensions_collection" Then execute: bundle install == Set up 1. Helpers Include a helper you want to use in Spec. Or include a helper in spec_helper.rb. e.g. config.include RSpecExtensionsCollection::Matchers::MongoidModelHelpers 2. Matchers Put the following in spec_helper.rb: config.include RSpecExtensionsCollection::Matchers == Usage 1. Helpers 2. Matchers 2-1. SearchMatcher search_by(*args) 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". The method to test: search(keyword) Example: BlogPost.should search_by(:title, :content, :locale => I18n.locale.to_s) 2-2. SearchEmbeddedMatcher - For Mongoid embedded documents. search_embedded_by(association_name, *args) 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". The method to test: search_embedded_by(keyword) Example: BlogPost.should search_embedded_by(:comments, :content, :locale => I18n.locale.to_s)
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rspec_extensions_collection-0.0.3 | README.rdoc |