changelog shortlog tags changeset manifest revisions annotate raw

vendor/plugins/rspec/spec/spec/example/predicate_matcher_spec.rb

changeset 15: 64acf98d15f4
author: moriq@moriq.com
date: Mon Mar 10 10:12:58 2008 +0900 (16 years ago)
permissions: -rw-r--r--
description: add plugins rspec
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