1require File.dirname(__FILE__) + '/../../spec_helper'
2
3module Spec
4 module Example
5 class Fish
6 def can_swim?(distance_in_yards)
7 distance_in_yards < 1000
8 end
9 end
10
11 describe "predicate_matcher[method_on_object] = matcher_method" do
12 predicate_matchers[:swim] = :can_swim?
13 it "should match matcher_method if method_on_object returns true" do
14 swim(100).matches?(Fish.new).should be_true
15 end
16 it "should not match matcher_method if method_on_object returns false" do
17 swim(10000).matches?(Fish.new).should be_false
18 end
19 end
20 end
21end