Sha256: 0e46b113a50eb8349189d78cdeb38c0e86767c8828bc02e795468bc0dd791463

Contents?: true

Size: 1.41 KB

Versions: 5

Compression:

Stored size: 1.41 KB

Contents

rspec-expectations is used to set expectations in executable examples.

    describe Account do
      it "has a balance of zero when first created" do
        Account.new.balance.should eq(Money.new(0))
      end
    end

## should and should_not

rspec-expectations adds `should` and `should_not` to every object. Each of
these can accept a matcher and, in most cases, an optional custom failure
message (see [customized
message](/rspec/rspec-expectations/v/2-3/customized-message)).

## Matchers

A Matcher is any object that responds to the following methods:

    matches?(actual)
    failure_message_for_should

These methods are also part of the matcher protocol, but are optional:

    does_not_match?(actual)
    failure_message_for_should_not
    description

RSpec ships with a number of [built-in
matchers](/rspec/rspec-expectations/v/2-3/dir/built-in-matchers) and a DSL for
writing your own [custom
matchers](/rspec/rspec-expectations/v/2-3/dir/custom-matchers).

## Issues

The documentation for rspec-expectations is a work in progress. We'll be adding
Cucumber features over time, and clarifying existing ones.  If you have
specific features you'd like to see added, find the existing documentation
incomplete or confusing, or, better yet, wish to write a missing Cucumber
feature yourself, please [submit an
issue](http://github.com/rspec/rspec-expectations/issues) or a [pull
request](http://github.com/rspec/rspec-expectations).

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
messagebus_ruby_api-0.4.7 spec/ruby/1.9.1/gems/rspec-expectations-2.5.0/features/README.markdown
messagebus_ruby_api-0.4.4 spec/ruby/1.9.1/gems/rspec-expectations-2.5.0/features/README.markdown
rspec-expectations-2.6.0.rc2 features/README.markdown
rspec-expectations-2.5.0 features/README.markdown
rspec-expectations-2.4.0 features/README.markdown