Skip to content

Instantly share code, notes, and snippets.

@turboladen
Created July 11, 2012 18:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save turboladen/3092271 to your computer and use it in GitHub Desktop.
Save turboladen/3092271 to your computer and use it in GitHub Desktop.
RSpec 2.11 .any_instance.should_not_receive bug
class Tester
def initialize(dont_do_it)
do_something unless dont_do_it == false
end
def do_something
puts "Doing it..."
end
end
describe Tester do
describe '#initialize' do
context 'dont_do_it is true' do
it 'calls do_something' do
Tester.any_instance.should_receive(:do_something)
Tester.new(true)
end
end
context 'dont_do_it is false' do
it 'does not call do_something' do
Tester.any_instance.should_not_receive(:do_something)
Tester.new(false)
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment