[rspec-users] Issue with AR::Base descendants with certain argument

Alexey Ilyichev bluesman.alex at gmail.com
Thu Oct 28 04:44:18 EDT 2010


I am trying to upgrade rspec-rails to 1.3.3, and one of my specs fails.

In before :each I stub finder method like this:
Payment.stub!(:find_by_id).with(@payment.id.to_s).and_return @payment
Payment class is derived from AR::Base

And then in one of the examples I call Payment.find_by_id((@payment.id +
1).to_s), and I am expecting it to return null, as it used to with 1.2.9
version, however it leads to an exception in active_record/base.rb.
Analyzing the stack trace I figured that in line 115 of mock/proxy.rb method
find_by_id is called for ActiveRecord::Base, which is not correct.

I'm not familiar with rspec internals, so I don't have an idea on where in
code the actual problem is. So any help would be greatly appreciated.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20101028/5b5564b8/attachment-0001.html>

More information about the rspec-users mailing list