[MacRuby-devel] macruby rspec mock odd behavior
gabriel at gabrielayuso.com
Wed May 4 13:16:06 PDT 2011
I'm having some strange issue with rspec mocks and hope someone can point out what I'm doing wrong.
I have a Objective C class with the method: buildRequestWithUrl:method:header:body:
I wrote an rspec mock for this class. I'm setting up an expectation as follows:
.with("http://example.com", method:"POST", header:nil, body:anything() )
When the class being tested calls the aforementioned method I get the following error:
NSInvalidArgumentException: -[Mock buildRequestWithUrl:method:header:body:]: unrecognized selector sent to instance 0x200373ea0
I set the expectations for another method of the same class called :queryStringForDictionary
In this case the expectation and call do work.
@requestBuilder.should_receive(:queryStringForDictionary).and_return( body )
In another project I'm calling the same class from ruby code and there the mocks and expectations do work properly. In this Objective C project they don't.
Thanks in advance,
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the MacRuby-devel