sneakin / spec_matcher_helper

Makes creating RSpec Matchers easier.

This URL has Read+Write access

name age message
file README Loading commit data...
file Rakefile
directory lib/
directory spec/
README
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