Sha256: d388be2497e58614c595ce8b5a31f057191dc98974d7fb6f2c09994df7ab27c8

Contents?: true

Size: 606 Bytes

Versions: 3

Compression:

Stored size: 606 Bytes

Contents

require File.dirname(__FILE__) + '/../../spec_helper'

module Spec
  module Example
    class Fish
      def can_swim?(distance_in_yards)
        distance_in_yards < 1000
      end
    end

    describe "predicate_matcher[method_on_object] = matcher_method" do
      predicate_matchers[:swim] = :can_swim?
      it "should match matcher_method if method_on_object returns true" do
        swim(100).matches?(Fish.new).should be_true
      end
      it "should not match matcher_method if method_on_object returns false" do
        swim(10000).matches?(Fish.new).should be_false
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
picolena-0.1.6 rails_plugins/rspec/spec/spec/example/predicate_matcher_spec.rb
picolena-0.1.7 rails_plugins/rspec/spec/spec/example/predicate_matcher_spec.rb
picolena-0.1.8 rails_plugins/rspec/spec/spec/example/predicate_matcher_spec.rb