Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

opsb-bourne

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

opsb-bourne

  • 1.0
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

= Bourne

Bourne extends mocha to allow detailed tracking and querying of stub and mock invocations. It allows test spies using the have_received rspec matcher and assert_received for Test::Unit. Bourne was extracted from jferris-mocha, a fork of mocha that adds test spies.

== Test Spies

Test spies are a form of test double that preserves the normal four-phase unit test order and allows separation of stubbing and verification.

Using a test spy is like using a mocked expectation except that there are two steps:

  1. Stub out a method for which you want to verify invocations
  2. Use an assertion or matcher to verify that the stub was invoked correctly

== Examples

rspec

mock.should have_received(:to_s) Radio.should have_received(:new).with(1041) radio.should have_received(:volume).with(11).twice radio.should have_received(:off).never

Test::Unit

assert_received(mock, :to_s) assert_received(Radio, :new) {|expect| expect.with(1041) } assert_received(radio, :volume) {|expect| expect.with(11).twice } assert_received(radio, :off) {|expect| expect.never }

See Mocha::API for more information.

== Download

Rubygems: gem install bourne

Github: http://github.com/thoughtbot/bourne/tree/master

== More Information

== Author

Bourne was written by Joe Ferris. Mocha was written by James Mead. Several of the test examples and helpers used in the Bourne test suite were copied directly from Mocha.

Thanks to thoughtbot for inspiration, ideas, and funding. Thanks to James for writing mocha.

Copyright 2010 Joe Ferris and thoughtbot[http://www.thoughtbot.com], inc.

FAQs

Package last updated on 06 Nov 2010

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc