[rspec-users] mock libraries, Object#send, and Object#__send__

Scott Taylor mailing_lists at railsnewbie.com
Thu Dec 6 17:33:34 EST 2007


On Dec 6, 2007, at 5:25 PM, David Chelimsky wrote:

> On Dec 6, 2007 4:22 PM, Scott Taylor  
> <mailing_lists at railsnewbie.com> wrote:
>>
>>
>> On Dec 6, 2007, at 5:12 PM, David Chelimsky wrote:
>>
>>> On Dec 6, 2007 4:08 PM, Scott Taylor
>>> <mailing_lists at railsnewbie.com> wrote:
>>>>
>>>> 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
>>>>>> library?
>>>>>

<snip>...</snip>

>> I'm not sure this is the best idea, but we could actually remove the
>> warning:
>>
>>      def execute_silently(&blk)
>>        old_warning_level = $VERBOSE
>>        $VERBOSE = nil
>>        yield
>>        $VERBOSE = old_warning_level
>>      end
>>
>>
>> (or I could do this myself, in my own specs)
>
> I'd be happier if you did that yourself. I don't want RSpec to be in
> the habit of hiding warnings.
>

Yep.  I don't disagree with you (especially now that I know that the  
warning comes from ruby itself).  Originally I thought that maybe the  
mock library used __send__, and issued a warning if you tried to stub  
it.

Scott



More information about the rspec-users mailing list