Skip to content
This repository

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

..
Octocat-spinner-32 message_expectations
Octocat-spinner-32 method_stubs
Octocat-spinner-32 outside_rspec
Octocat-spinner-32 support
Octocat-spinner-32 .nav
Octocat-spinner-32 Changelog.md
Octocat-spinner-32 README.markdown
Octocat-spinner-32 Upgrade.md
README.markdown

rspec-mocks is used to create dynamic "doubles", which stand in for real objects in examples. You can stub return values and/or set message expectations:

describe Account do
  context "when closed" do
    it "logs an account closed message" do
      logger = double()
      account = Account.new
      account.logger = logger

      logger.should_receive(:account_closed).with(account)

      account.close
    end
  end
end

Issues

The documentation for rspec-mocks 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.