Re: Mocking framework

  • From: Brian Guthrie <btguthrie@gmail.com>
  • To: "dev@ioke.kenai.com" <dev@ioke.kenai.com>
  • Subject: Re: Mocking framework
  • Date: Tue, 27 Jan 2009 10:47:23 -0500
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:from:to:in-reply-to:content-type :content-transfer-encoding:x-mailer:mime-version:subject:date :references; b=W30lI/fbqUxZaXs5ooZqtcXlCnYRDiBBlq86pcSWfUoi3zLnm79hu8hiWaDQKjvOWV j+1Ta8idJRve8FZeBryAUSHJv2J0Pqnqdy05+9+cFgf6MFHqhVc2HmwtGzkPo1lkSGDe OD7rOLr1ekWLQSxJ5xWMaVn80Ly69MuQlRsok=



On Jan 27, 2009, at 2:12 AM, Ola Bini <ola.bini@gmail.com> wrote:


Okay, I've modified the should receive syntax to perform in the way
you suggested and pushed it up to Github, although 'foo expects' still
works.  Would it be better to just go whole-hog and throw it out?  I
just feel burned by the mocha vs. RSpec mocking religious war in the
Ruby world but since we have a chance to start over here maybe I'm
over-thinking it.

I think I'm going to provide a mock() primitive for easy mock creation
through a hash primitive, but I'm left with a question about syntax
that's been bugging me. The with() macro accepts a JS-style hash- like
syntax that appears to require special handling to support (arg name
asText[0..0-2]) and doesn't have wider support in the codebase AFAICT.
Is that the kind of syntax you'd expect to see from a call to mock?
Or should it just accept a plain old hash?  E.g.

foo = mock(foo: "bar", baz: "qux") vs.
foo = mock(:foo => "bar", :baz => "qux")

or am I barking up the wrong tree entirely?  Ola, did you have a more
succinct syntax you imagined for that kind of a construct?  Or is
with() a failed experiment? I don't see it referenced anywhere in the
wiki guide.



Taking this to the mailing lists - since its of general interest.
First, mocking. Well, community, what do you think? I don't have a strong opinion.

Second, the with-macro could almost be implemented as regular keyword arguments. The reason it is not is that doing it this way allow you to intersperse regular code with the arguments. So, you can do:

Origin with(foo: 42,
"hello world" println)

it is not a failed experiment, it just isn't documented. =)

Cheers

--
Ola Bini (http://olabini.com) Ioke creator (http://ioke.org)
JRuby Core Developer (http://jruby.org)
Developer, ThoughtWorks Studios (http://studios.thoughtworks.com)
Practical JRuby on Rails (http://apress.com/book/view/9781590598818)

"Yields falsehood when quined" yields falsehood when quined.


Sorry--totally meant to send this to the wider list.


Mocking framework

Brian Guthrie 01/26/2009

Re: Mocking framework

Ola Bini 01/26/2009

Message not available

Message not available

Message not available

Re: Mocking framework

Ola Bini 01/27/2009

Re: Mocking framework

Brian Guthrie 01/27/2009
  • Mysql
  • Glassfish
  • Jruby
  • Rails
  • Nblogo
Terms of Use; Privacy Policy;
© 2010, Oracle Corporation and/or its affiliates
(revision 20120127.ac94057)
 
 
Close
loading
Please Confirm
Close