Hi,

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:

        @requestBuilder.should_receive(:buildRequestWithUrl)
                       .with("http://example.com";, method:"POST", header:nil, 
body:anything() )
                       .and_return(nil)

When the class being tested calls the aforementioned method I get the following 
error:

RuntimeError:
       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,
Gabriel Ayuso
_______________________________________________
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel

Reply via email to