This repository is private.
All pages are served over SSL and all pushing and pulling is done over SSH.
No one may fork, clone, or view it unless they are added as a member.
Every repository with this icon (
) is private.
Every repository with this icon (
This repository is public.
Anyone may fork, clone, or view it.
Every repository with this icon (
) is public.
Every repository with this icon (
Run the following if you haven't already:
gem sources -a http://gems.github.com
Install the gem(s):
sudo gem install xdotcommer-rspec-custom-matchers
Greg Weber (author)
Thu Apr 16 08:15:22 -0700 2009
Michael Cowden (committer)
Thu Apr 16 13:03:56 -0700 2009
| name | age | message | |
|---|---|---|---|
| |
.gitignore | ||
| |
README.markdown | ||
| |
Rakefile | ||
| |
VERSION.yml | ||
| |
lib/ | ||
| |
rspec-custom-matchers.gemspec | ||
| |
spec/ |
RSpec Custom Matchers
This gem makes it really easy to define your own RSpec custom matchers in 1 line of code.
This class / project is created by xdotcommer and updated by remi to make it an easy-to-install RubyGem.
Install
sudo gem install rspec-custom-matchers -s http://gems.github.com
Usage
Wherever you want to include the matcher method, include CustomMatcher::Helper
Remember, if you want to be able to call matcher(:foo) in the body of a class,
you might want to extend CustomMatcher::Helper instead of including it.
Personally, I like to keep all of my own custom matchers for a project in a module, so I do ...
require 'rspec-custom-matchers'
module MyMatchers
extend CustomMatcher::Helper
matcher(:be_divisible_by) { |number, divisor| number % divisor == 0 }
matcher(:be_even) { |even| even % 2 == 0 }
matcher(:be_odd) { |odd| odd % 2 != 0 }
matcher(:be_equal_to)
end
and then, in my spec_helper.rb
require 'my_matchers'
Spec::Runner.configure do |config|
config.include MyMatchers # this will make the matchers available to your specs
end
That's how I do it!
TODO
- should support
matcher(:x){}as well as merb'sSpec::Matcher.create, which has more features and can be found atmerb-core/lib/merb-core/test/test_ext/rspec.rb












