Forum: RSpec warn on stubbing nonexistent method?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
40c8f707cab5f50878cee873881d6b75?d=identicon&s=25 Roger P. (rogerdpack)
on 2011-08-26 19:02
Hello.
Perhaps rspec-mocks could warn if it stubs a not yet existing method?


class A
end

describe RSpec do
 it 'should' do
   a = A.new
   a.stub!(:nonexistent_method) {}
 end
end

This might help the development process by pointing out possible
discrepancies between rspec tests and the code (for when refactoring
wasn't performed fully et al).
Cheers!
-roger-
David Chelimsky (Guest)
on 2011-08-26 20:37
(Received via mailing list)
On Aug 26, 2011, at 12:02 PM, Roger Pack wrote:

> Hello.
> Perhaps rspec-mocks could warn if it stubs a not yet existing method?

See https://github.com/rspec/rspec-mocks/issues/15

Cheers,
David
A1df41689f1c91625c8806cde536e3fc?d=identicon&s=25 Evgeniy D. (dolzenko)
on 2011-08-26 22:18
(Received via mailing list)
Roger,

Check the list archives - this topic is brought up every other 3 months
:)
This topic is locked and can not be replied to.