Created
April 1, 2012 10:36
-
-
Save rubypanther/2274375 to your computer and use it in GitHub Desktop.
An RSpec "undefined method" oddity
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 UndefinedMethodOddity | |
def foo | |
bar 1 | |
bar 2 | |
end | |
def bar(arg) | |
end | |
end | |
describe UndefinedMethodOddity do | |
describe '#foo' do | |
it "correctly complaints 'expected: 1 time, received: 2 times'" do | |
subject.should_receive(:bar) | |
subject.foo | |
end | |
it "strangely complains about 'undefined method `bar' for #<UndefinedMethodOddity'" do | |
subject.stub(:bar) | |
subject.should_receive(:bar).with(1) | |
subject.foo | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment