adding all of botlist, initial add
[botlist.git] / openbotlist / WEB-INF / lib / ruby / rspec / spec / spec / example / predicate_matcher_spec.rb
blob7c4638b4bf9dd4c1ccee22c1b3cec3ac13805926
1 require File.dirname(__FILE__) + '/../../spec_helper'
3 module 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
21 end