RDingus

1 view
Skip to first unread message

faithfulgeek

unread,
Dec 11, 2008, 9:58:19 PM12/11/08
to CleRB
This was the result of our first hackfest-style meeting. It's not
complete, not even close, but it will eventually be a new mocking
framework for Ruby that introduces a different paradigm. Others can
explain it better than I, so I will leave it to them. See the code
here:

http://gist.github.com/34994

Jonathan Penn

unread,
Dec 12, 2008, 3:09:08 AM12/12/08
to CleRB
Gentlemen, I know it's 3am, but I just couldn't sleep until I hacked
more at the RDingus.

Here's my gist fork: http://gist.github.com/34995

I'm curious to hear what you think, Gary. Both of my implementation
and of my test coverage. :-)

I didn't quite remember some of the details of how Dingus worked, and
I took some ruby-ish liberties in this version. So there's a lot of
work left to integrate what else you learned in your usage of the
framework. But the simple test cases work out for me, and I can see
how I can start using this on my own projects!!

I fleshed out the Person and sandwich examples, too.

To give you a taste, here's some of the syntactical goodies you get.

d = RDingus.new
d.a_method
d.calls -> a_method()

d.b_method.returns :sandwich
d.c_method.d_method.returns :manwich

puts d.b_method # sandwich
puts d.c_method.d_method # manwich

d.remember(:me)
puts d.calls[0].args[0] # me
puts d.calls[0].method # remember
puts d.has_called?(:me) # true
# I used has_called? because it's used in
rspec as have_called(blah)

Let me know what you think!
Reply all
Reply to author
Forward
0 new messages