Module: Spec::Example::PredicateMatchers

Module | Spec::Example::PredicateMatchers
In: | lib/spec/example/predicate_matchers.rb

### Methods

predicate_matchers

### Public Instance methods

predicate_matchers[matcher_name] = method_on_object
predicate_matchers[matcher_name] = [method1_on_object, method2_on_object]

Dynamically generates a custom matcher that will match a predicate on your class. RSpec provides a couple of these out of the box:

      exist (for state expectations)
        File.should exist("path/to/file")

      an_instance_of (for mock argument matchers)
        mock.should_receive(:message).with(an_instance_of(String))

## Examples

      class Fish
        def can_swim?
          true
        end
      end

      describe Fish do
        predicate_matchers[:swim] = :can_swim?
        it "should swim" do
          Fish.new.should swim
        end
      end

[Validate]