[rspec-users] mock libraries, Object#send, and Object#__send__
mailing_lists at railsnewbie.com
Thu Dec 6 17:08:21 EST 2007
On Dec 6, 2007, at 4:41 PM, David Chelimsky wrote:
> On Dec 6, 2007 3:37 PM, Scott Taylor
> <mailing_lists at railsnewbie.com> wrote:
>> What is the appropriate way to stub out (and put an expectation on
>> Object#__send__), without getting warnings from the Rspec mock
> Come on Scott - you know better than that :)
> Error please?
Not an error, just a warning. And I should have written my
description better. Basically, I wanted to make sure that my library
didn't call send, but instead __send__. I tried something like this:
before :each do
@caller = Object.new
it "should be able to send the message with __send__" do
The @caller object is a sort of mock object. I would have used a
real mock object, except that stubbing send on a mock object didn't
seem to do anything.
The warning was this:
proxy.rb:99: warning: redefining `__send__' may cause serious problem
Just wondering about what you would recommend for this. Let me know
if you need more context.
More information about the rspec-users