Ivan Porto Carrero

IO(thoughts) flatMap (_.propagandize)



An Update on Caricature

Yesterday I explained about caricature but I didn’t have it fully tested yet. Today I’ve written a bunch of integration specs for all the platform combinations Caricature currently supports so you should be able to use Caricature also for plain ruby object mocking in addition to CLR interop mocking.

After having a very brief twitter discussion with Scott I decided it would be a good idea to change the name of the methods when_told_to and was_told_to? . In ruby objects receive messages so the wording now becomes when_receiving and did_receive? . I have a problem with the should naming because there is nothing conditional about it. Either you want the method to return something or you want it to return a default value for CLR value types or nil. And if you’re asserting if a method it called that is deterministic; it is either called or not there is no gray area there.

ninja = ClrModels::Ninja.new


@ninja.attack(ninja, @weapon).should.equal 5


Before I call it 1.0 I want to at least give ruby objects also the ability to isolate static and sealed methods as well as mocking ruby class methods. So that for CLR to Ruby interaction you a get the full range of possibilities.

I have also set up a site on github that contains the API documentation for Caricature. When IronRuby 0.5 releases I’ll publish a blog post that will talk you through testing your CLR assembly with IronRuby, bacon and Caricature.

For now you can take a look here for example on how to use Caricature for isolating features.


To top