--- !ruby/object:RI::MethodDescription 
aliases: []

block_params: 
comment: 
- !ruby/struct:SM::Flow::P 
  body: wraps an expectation in a block that will return true if the expectation passes and false if it fails (without bubbling up the failure).
- !ruby/struct:SM::Flow::P 
  body: This is intended to be used in the context of a simple matcher, and is especially useful for wrapping multiple expectations or one or more assertions from test/unit extensions when running with test/unit.
- !ruby/struct:SM::Flow::H 
  level: 2
  text: Examples
- !ruby/struct:SM::Flow::VERB 
  body: "  def eat_cheese(cheese)\n    simple_matcher do |mouse, matcher|\n      matcher.failure_message = &quot;expected #{mouse} to eat cheese&quot;\n      wrap_expectation do |matcher|\n        assert_eats_cheese(mouse)\n      end\n    end\n  end\n\n  describe Mouse do\n    it &quot;eats cheese&quot; do\n      Mouse.new.should eat_cheese\n    end\n  end\n"
- !ruby/struct:SM::Flow::P 
  body: You might be wondering &quot;why would I do this if I could just say&quot; assert_eats_cheese?&quot;, a fair question, indeed. You might prefer to replace the word assert with something more aligned with the rest of your code examples. You are using rspec, after all.
- !ruby/struct:SM::Flow::P 
  body: "The other benefit you get is that you can use the negative version of the matcher:"
- !ruby/struct:SM::Flow::VERB 
  body: "  describe Cat do\n    it &quot;does not eat cheese&quot; do\n      Cat.new.should_not eat_cheese\n    end\n  end\n"
- !ruby/struct:SM::Flow::P 
  body: So in the event there is no assert_does_not_eat_cheese available, you're all set!
full_name: Spec::Matchers#wrap_expectation
is_singleton: false
name: wrap_expectation
params: (matcher, &block)
visibility: public
