Sha256: 3e78492d08cd88d85f9b9a97a74233acfb2f6754e5e10227cec74a41dca6166f

Contents?: true

Size: 1.06 KB

Versions: 10

Compression:

Stored size: 1.06 KB

Contents

Feature: Satisfy matcher

  The satisfy matcher is extremely flexible and can handle almost anything
  you want to specify.  It passes if the block you provide returns true:

    10.should satisfy { |v| v % 5 == 0 }
    7.should_not satisfy { |v| v % 5 == 0 }

  This flexibility comes at a cost, however: the failure message
  ("expected [actual] to satisfy block") is not very descriptive
  or helpful.  You will usually be better served by using one of
  the other built-in matchers, or writing a custom matcher.

  Scenario: basic usage
    Given a file named "satisfy_matcher_spec.rb" with:
      """
      describe 10 do
        it { should satisfy { |v| v > 5 } }
        it { should_not satisfy { |v| v > 15 } }

        # deliberate failures
        it { should_not satisfy { |v| v > 5 } }
        it { should satisfy { |v| v > 15 } }
      end
      """
    When I run "rspec satisfy_matcher_spec.rb"
    Then the output should contain all of these:
      | 4 examples, 2 failures           |
      | expected 10 not to satisfy block |
      | expected 10 to satisfy block     |

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
vim-jar-0.1.2.0001 bundler/ruby/1.8/gems/rspec-expectations-2.1.0/features/matchers/satisfy.feature
vim-jar-0.1.2 bundler/ruby/1.8/gems/rspec-expectations-2.1.0/features/matchers/satisfy.feature
vim-jar-0.1.1 bundler/ruby/1.8/gems/rspec-expectations-2.1.0/features/matchers/satisfy.feature
vim-jar-0.1.0 bundler/ruby/1.8/gems/rspec-expectations-2.1.0/features/matchers/satisfy.feature
rspec-expectations-2.3.0 features/matchers/satisfy.feature
vim-jar-0.0.3 bundler/ruby/1.8/gems/rspec-expectations-2.1.0/features/matchers/satisfy.feature
vim-jar-0.0.2 bundler/ruby/1.8/gems/rspec-expectations-2.1.0/features/matchers/satisfy.feature
vim-jar-0.0.1 bundler/ruby/1.8/gems/rspec-expectations-2.1.0/features/matchers/satisfy.feature
rspec-expectations-2.2.0 features/matchers/satisfy.feature
rspec-expectations-2.1.0 features/matchers/satisfy.feature