Hello all,
I've been trying to use caricature to stub my services in my controllers
tests, now when I try to test this code:
public TestController(ITestService service)
{
_service = service;
}
when my interface is:
public interface ITestService
{
string GetContent();
}
like so:
s = isolate ITestService
s.when_receiving(:get_content).return('some content')
c = TestController.new s
I get the above mentioned error (see attachment)
Any ideas what I'm doing wrong?
on 2010-08-04 11:17
on 2010-08-04 21:57
Hi Nieve, I don't see anything that looks wrong. Which version of IronRuby are you using? Let me know and I'll see if I can reproduce the problem. If I can, I'll take a stab at debugging it. Regards, -Charles
on 2010-08-04 22:10
Hi Charles, First of all, thanks for the reply. I'm currently on IronRuby 1.1 Now, I just doubled checked this, and this happens whether I call isolate the interface or the implementation. Also, I presume that's something with my code since Ben Hall's Kona example (that uses the same code) works on my machine... I can create a quick project and put it on github so it'll be easier to reproduce. cheers, ~n Charles Strahan wrote: > Hi Nieve, > > I don't see anything that looks wrong. Which version of IronRuby are > you > using? > > Let me know and I'll see if I can reproduce the problem. If I can, I'll > take a stab at debugging it. > > > Regards, > > -Charles
on 2010-08-04 22:29
Hi Nieve, Sure thing. Let me know when you put the sample project up on github and I'll take a look at it. -Charles
on 2010-08-04 22:56
Charles, you can take a look at it here: http://github.com/nieve/IsolationTest I just hope it's not something completely obvious...
on 2010-08-04 23:16
Nieve, Oh... my... goodness... I've never seen ANYONE make that mistake before! Just kidding ;P I'll take a look at it a little later, unless someone else beats me to it. ;) Cheers, -Charles
on 2010-08-04 23:42
I just looked at your sample project It's best to require spec before caricature because caricature hooks into spec The IHomeRepository interface is empty. Try adding a method to that and see if it still occurs. you can also add require 'caricature/aspnet_mvc' I don't have a windows machine running atm but I'll check tomorrow if this didn't help you --- Met vriendelijke groeten - Best regards - Salutations Ivan Porto Carrero Author of IronRuby in Action (http://manning.com/carrero) Microsoft IronRuby/C# MVP
on 2010-08-05 00:06
try doing ITestService.isolate or isolation_for ITestService --- Met vriendelijke groeten - Best regards - Salutations Ivan Porto Carrero Author of IronRuby in Action (http://manning.com/carrero) Microsoft IronRuby/C# MVP
on 2010-08-05 08:53
@Ivan- Many many thanks!! that worked :) I did also try to put require spec before caricature, but that didn't help. I left it though like that, since it makes sense. The one thing I still don't get is how come in Ben's Kona example the isolate Service works and on the same machine, my code doesn't... am wondering what could possibly differ, would be interesting to know. ~n
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.
