Created
September 6, 2011 17:30
-
-
Save bkempner/1198323 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
require 'spec_helper' | |
describe 'wtf' do | |
it "doesn't allow non-mocked method calls if any methods are mocked" do | |
u = User.new | |
mock(u).first_name | |
u.first_name | |
u.last_name | |
end | |
# unexpected method call last_name() | |
# need something like rspec mocks .as_null_object: http://apidock.com/rspec/Spec/Mocks/Methods/as_null_object | |
# copy and past of spies example: https://github.com/btakita/rr | |
it "doesn't work with spies" do | |
subject = Object.new | |
stub(subject).foo | |
subject.foo(1) | |
subject.should have_received.foo(1) | |
end | |
# undefined method foo | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment