public
Description: Makes creating RSpec Matchers easier.
Homepage: http://nolan.eakins.net/node/311
Clone URL: git://github.com/sneakin/spec_matcher_helper.git
100644 30 lines (24 sloc) 0.484 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
RSpec Matcher Helper
=====================
 
Created by Nolan Eakins <nolan@eakins.net>
This library is in the public domain.
 
An Example
===========
 
matcher :inherits_from do
  def initialize(expecting)
    @expecting = expecting
  end
 
  def matches?(target)
    target == @expecting
  end
end
 
matcher :match_five => :inherits_from do
  def initialize #:nodoc:all
    super(5)
  end
end
 
describe Something do
  it "uses the matcher" do
    (2 + 2).should_not match_five
  end
end