Created
July 11, 2012 18:41
-
-
Save turboladen/3092271 to your computer and use it in GitHub Desktop.
RSpec 2.11 .any_instance.should_not_receive bug
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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