No commit activity in last 3 years
No release in over 3 years
Collection of RSpec extensions incluing helper methods, matchers, and macros that the author would like to use for multiple projects.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 1.0.0
>= 2.0.0.beta1
>= 0

Runtime

>= 0
 Project Readme

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¶ ↑

Note: 
  This gem is using FactoryGirl as Factory. So in the project using this gem, FactoryGirl must be set up. 
  So in Gemfile, either of the followings should be put:
    For non Ruby on Rails project:
      gem "factory_girl", ">=2.0.0.beta1"
    For Ruby on Rails project:
      gem "factory_girl_rails", ">=1.1.beta1"
  Then under spec directory, create a file factories.rb. See https://github.com/thoughtbot/factory_girl for more detail.

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)

License¶ ↑

Copyright (c) 2010-2011, Tadatoshi Takahashi

RSpec extensions collection is released under the MIT license.