Skip to content
This repository
Browse code

Add cuke for satisfy matcher.

  • Loading branch information...
commit abc0ef44598af76942c191708eb477cec64e107d 1 parent 9393080
Myron Marston myronmarston authored dchelimsky committed

Showing 1 changed file with 31 additions and 0 deletions. Show diff stats Hide diff stats

  1. +31 0 features/matchers/satisfy.feature
31 features/matchers/satisfy.feature
... ... @@ -0,0 +1,31 @@
  1 +Feature: Satisfy matcher
  2 +
  3 + The satisfy matcher is extremely flexible and can handle almost anything
  4 + you want to specify. It passes if the block you provide returns true:
  5 +
  6 + 10.should satisfy { |v| v % 5 == 0 }
  7 + 7.should_not satisfy { |v| v % 5 == 0 }
  8 +
  9 + This flexibility comes at a cost, however: the failure message
  10 + ("expected [actual] to satisfy block") is not very descriptive
  11 + or helpful. You will usually be better served by using one of
  12 + the other built-in matchers, or writing a custom matcher.
  13 +
  14 + Scenario: basic usage
  15 + Given a file named "satisfy_matcher_spec.rb" with:
  16 + """
  17 + describe 10 do
  18 + it { should satisfy { |v| v > 5 } }
  19 + it { should_not satisfy { |v| v > 15 } }
  20 +
  21 + # deliberate failures
  22 + it { should_not satisfy { |v| v > 5 } }
  23 + it { should satisfy { |v| v > 15 } }
  24 + end
  25 + """
  26 + When I run "rspec satisfy_matcher_spec.rb"
  27 + Then the output should contain all of these:
  28 + | 4 examples, 2 failures |
  29 + | expected 10 not to satisfy block |
  30 + | expected 10 to satisfy block |
  31 +

0 comments on commit abc0ef4

Please sign in to comment.
Something went wrong with that request. Please try again.