Skip to content
This repository
branch: 2-7-maintenance

This branch is 1 commit ahead and 1066 commits behind master

Fetching latest commit…


Cannot retrieve the latest commit at this time

Octocat-spinner-32 built_in_matchers
Octocat-spinner-32 custom_matchers
Octocat-spinner-32 step_definitions
Octocat-spinner-32 support
Octocat-spinner-32 test_frameworks
Octocat-spinner-32 .nav
Octocat-spinner-32 README.markdown
Octocat-spinner-32 customized_message.feature
Octocat-spinner-32 diffing.feature
Octocat-spinner-32 implicit_docstrings.feature

rspec-expectations is used to define expected outcomes.

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

Basic structure

The basic structure of an rspec expectation is:

actual.should matcher(expected)
actual.should_not matcher(expected)

should and should_not

rspec-expectations adds should and should_not to every object in the system. These methods each accept a matcher as an argument. This allows each matcher to work in a positive or negative mode:

5.should eq(5)
5.should_not eq(4)

What is a matcher?

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




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



Something went wrong with that request. Please try again.