Hey Constantin,

Hope you are well.

I'd recommend not overriding Ruby's "test" method, or any core method. Got
a different name that works as well in context?

Cheers,
David


On Tue, Apr 9, 2013 at 3:24 PM, Constantin Gavrilescu <
[email protected]> wrote:

> I'm trying to stub the method "test" on an object, and I cannot do it with
> rspec.
>
> Example with a simpler case:
>
>     o = Object.new
>     o.stub!(:test).and_return "lol"
>     o.test.should == "lol"
>
> Error:
>     Failure/Error: o.test.should == "lol"
>     NoMethodError: private method `test' called for
> #<Object:0x13cf47e4>
>
> This is probably because Kernel implements #test and stubs are done with
> method_missing.
> What's the recommended way to deal this this?
>
> --
> You received this message because you are subscribed to the Google Groups
> "rspec" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msg/rspec/-/cd5FnRaMQJsJ.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"rspec" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to