Project

stirlitz

0.0
No release in over 3 years
Low commit activity in last 3 years
Test spy extension to rspec-mocks
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

~> 2.5.0
~> 2.5.0
 Project Readme

Stirlitz 0.0.1¶ ↑

A Test Spy extension to rspec-mocks.

Installing¶ ↑

gem install stirlitz

or add following in your Gemfile

gem 'stirlitz', :group => :test

Examples¶ ↑

With Stirlitz installed you can verify your mocks post calls

it "lets me know if a call had been made" do
  a_spy = spy(:spy)
  a_spy.a_method
  a_spy.should have_received(:a_method)
  a_spy.should_not have_received(:no_method)
end

It is also possible to verify the arguments passed while method invocation

it "lets me know if certain arguments were used" do
  a_spy = spy(:spy)
  a_spy.a_method(10, 20)
  a_spy.should have_received(:a_method).with(10, 20)
end

Limitations¶ ↑

The following will currently fail, and you have to mandatorily mention .with() if the method is being called with arguments.

it "lets me know if a call had been made with or without arguments" do
  a_spy = spy(:spy)
  a_spy.a_method(10, 20)
  a_spy.should have_received(:a_method) # This assertion will fail
end