[Ironruby-core] Building expressions

Ryan Riley ryan.riley at panesofglass.org
Tue May 5 10:19:20 EDT 2009


Ivan,

You may want to try Jeremy Mcanally's
stump<http://github.com/jeremymcanally/stump/tree/master>mocking
framework. I haven't used it much, so I can't give any additional
info on it. It may not be what you are wanting, but if you just need mocks,
it may be worth a shot.


Ryan Riley
ryan.riley at panesofglass.org
http://panesofglass.org/
http://wizardsofsmart.net/


On Sun, May 3, 2009 at 4:37 PM, Shri Borde <Shri.Borde at microsoft.com> wrote:

>  It cannot be done. Even if you could get to the ExpressionTree of a Ruby
> lambda, the ExpressionTree would be loosely-bound as Ruby uses duck-typing,
> whereas Moq expects a strongly-typed ExpressionTree so that it can figure
> out the exact method that you are trying to associate some expectation with.
>
>
>
> FWIW, Mark had also been playing with mocking, and in our discussions, we
> said that the easiest mocking approach would be to use Ruby features like
> method_missing, monkey-patching, etc (like rspec does). Ie. something like
> this:
>
>
>
> def mock(clrInterface):
>
>   class ClrMock < clrInterface
>
>     # monkey-patch all of “clrInterface.methods" here, and redirect to the
> mocking framework
>
>   end
>
>   return ClrMock.new
>
> end
>
>
>
> *From:* ironruby-core-bounces at rubyforge.org [mailto:
> ironruby-core-bounces at rubyforge.org] *On Behalf Of *Ivan Porto Carrero
> *Sent:* Sunday, May 03, 2009 3:18 AM
> *To:* ironruby-core
> *Subject:* [Ironruby-core] Building expressions
>
>
>
> Hi
>
> I'm trying to get some Moq mockery going in IronRuby but Moq expects
> Expression<Func<MyObject, TReturn>> in his methods.
> Is there a way to make a RubyProc/lambda return an expression or convert it
> to an expression?
>
> ---
> Met vriendelijke groeten - Best regards - Salutations
> Ivan Porto Carrero
> Author of IronRuby in Action (http://manning.com/carrero)
>
> Steve Martin<http://www.brainyquote.com/quotes/authors/s/steve_martin.html> - "I've got to keep breathing. It'll be my worst business mistake if I
> don't."
>
> _______________________________________________
> Ironruby-core mailing list
> Ironruby-core at rubyforge.org
> http://rubyforge.org/mailman/listinfo/ironruby-core
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20090505/841dea29/attachment.html>


More information about the Ironruby-core mailing list