
Security News
New Website “Is It Really FOSS?” Tracks Transparency in Open Source Distribution Models
A new site reviews software projects to reveal if they’re truly FOSS, making complex licensing and distribution models easy to understand.
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 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:
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
You also want to configure RSpec to use mocha for mocking:
RSpec.configure do |config|
config.mock_with :mocha
end
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.
gem install bourne
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.
Thank you to all the contributors!
The names and logos for thoughtbot are trademarks of thoughtbot, inc.
Bourne is Copyright © 2010-2013 Joe Ferris and thoughtbot. It is free software, and may be redistributed under the terms specified in the LICENSE file.
FAQs
Unknown package
We found that bourne demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
A new site reviews software projects to reveal if they’re truly FOSS, making complex licensing and distribution models easy to understand.
Security News
Astral unveils pyx, a Python-native package registry in beta, designed to speed installs, enhance security, and integrate deeply with uv.
Security News
The Latio podcast explores how static and runtime reachability help teams prioritize exploitable vulnerabilities and streamline AppSec workflows.