Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master

Update to aruba 0.6.2.

0.6.2 removes regexp so we need to stop using it.
latest commit 5e8f55684f
@myronmarston myronmarston authored
Failed to load latest commit information.
built_in_matchers Add docs and features around `to_std(out|err)_from_any_process` matchers
custom_matchers add additional scenario for defining method manually
step_definitions Update to aruba 0.6.2.
test_frameworks format features line breaks
.nav Fix `have_attributes` title and nav. Add `supports_block_expectations?` to matcher protocol.
composing_matchers.feature format features line breaks
compound_expectations.feature Add Boolean AND, OR operators (&, |)
customized_message.feature more proper formatting
define_negated_matcher.feature Add `define_negated_matcher`
diffing.feature Use consistent APIs in cukes.
implicit_docstrings.feature format features line breaks
syntax_configuration.feature more proper formatting

rspec-expectations is used to define expected outcomes.

RSpec.describe Account do
  it "has a balance of zero when first created" do
    expect( eq(

Basic structure

The basic structure of an rspec expectation is:

expect(actual).to matcher(expected)
expect(actual).not_to matcher(expected)

Note: You can also use expect(..).to_not instead of expect(..).not_to. One is an alias to the other, so you can use whichever reads better to you.


expect(5).to eq(5)
expect(5).not_to eq(4)

What is a matcher?

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


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


RSpec ships with a number of built-in matchers and a DSL for writing custom matchers.


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 or a pull request.

Something went wrong with that request. Please try again.