~ubuntu-branches/ubuntu/oneiric/puppet/oneiric-security

« back to all changes in this revision

Viewing changes to vendor/gems/rspec/spec/spec/example/predicate_matcher_spec.rb

  • Committer: Bazaar Package Importer
  • Author(s): Micah Anderson
  • Date: 2008-07-26 15:43:45 UTC
  • mfrom: (1.1.8 upstream) (3.1.1 lenny)
  • Revision ID: james.westby@ubuntu.com-20080726154345-c03m49twzxewdwjn
Tags: 0.24.5-2
* Fix puppetlast to work with 0.24.5
* Adjust logcheck to match against new log messages in 0.24.5
* Update standards version to 3.8.0 (no changes)
* Update changelog to reduce length of line to make lintian happy

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
require File.dirname(__FILE__) + '/../../spec_helper'
 
2
 
 
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