I''ve finally managed to find some time to do some serious work on Mocha. There are some code snippets on my blog (http://blog.floehopper.org/articles/2007/04/12/preview-of-latest-mocha-changes) showing the new functionality available in trunk (revision 128). I don''t don''t know how many people out there are using trunk, but it would be great to get some feedback on these changes before I make a new release. In particular I''d like to know whether? - I''ve broken anybody''s tests. - Anybody has a legitimate use for parameter_block in Expectation#with that they don''t think will be handled by a suitable parameter matcher i.e. using the current behaviour where the block is passed the parameters and the result of the block determines whether the expectation matches. I''m planning on deprecating this soon. - Anybody has a legitimate use for passing in an instance of Proc to Expectation#returns i.e. using the current behaviour where the Proc gets executed to generate a return value. I''m planning on deprecating this soon as well. Thanks for all your ideas and suggestions. -- James. http://blog.floehopper.org
On 12 Apr 2007, at 18:21, James Mead wrote:> - Anybody has a legitimate use for passing in an instance of Proc to > Expectation#returns i.e. using the current behaviour where the Proc > gets executed to generate a return value. I''m planning on deprecating > this soon as well.I use this. Some of my tests test that my models behave correctly in the presence of certain exception being thrown (eg a socket connection dieing, ActiveRecord raising a StaleObjectError etc...) I use the Proc behaviour so that the first call raises and the second call doesn''t i.e actions = [lambda {raise Foo}, lambda {:blah}] thing.stubs(:foo).returns(lambda {actions.shift.call}) Fred
The idea would be you could use the new functionality to do something like this instead... thing.stubs(:foo).raises(Foo).then.returns(:blah) Does that make sense? -- James. http://blog.floehopper.org
D''oh, hadn''t read past the list of things that were being deprecated. All looks good to me ! Fred On 12 Apr 2007, at 20:56, James Mead wrote:> The idea would be you could use the new functionality to do something > like this instead... > > thing.stubs(:foo).raises(Foo).then.returns(:blah) > > Does that make sense? > > -- > James. > http://blog.floehopper.org > _______________________________________________ > mocha-developer mailing list > mocha-developer at rubyforge.org > http://rubyforge.org/mailman/listinfo/mocha-developer
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 James- My tests have not been broken by the latest updates. Also I have not yet needed to pass blocks around, so I have no ''in-use'' response to your two deprecations you want to do. I could see wanting to pass a block in Expectation#with, but can''t give a real example. On Expectation#returns, I did see a need to have the return execute a block to return data, but after a few mins I changed my mind. I don''t think that I''d want to do this in the future, especially after I talked myself out of doing it the first time. I do like the other features you''ve given, especially the multiple_yields. - -- Virtually, Ned Wolpert <ned.wolpert at gmail.com> ACF63C1E An idea is something you have; an ideology is something that has you. -Morris Berman -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.3 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFGHrGo2nkMaKz2PB4RAiuEAKCwsP1n0ItzypD99s1C6oQdQ5719gCfRcio okbPV2ErMAnHqMXBmRPBHOo=6Ux3 -----END PGP SIGNATURE-----
This looks awesome James. I now wish I''d submitted a Railsconf talk about mocha instead of heckle (no love for the heckle these days :( ). It just gets better and better. On 4/12/07, James Mead <jamesmead44 at gmail.com> wrote:> I''ve finally managed to find some time to do some serious work on > Mocha. There are some code snippets on my blog > (http://blog.floehopper.org/articles/2007/04/12/preview-of-latest-mocha-changes) > showing the new functionality available in trunk (revision 128). I > don''t don''t know how many people out there are using trunk, but it > would be great to get some feedback on these changes before I make a > new release. In particular I''d like to know whether? > > - I''ve broken anybody''s tests. > - Anybody has a legitimate use for parameter_block in Expectation#with > that they don''t think will be handled by a suitable parameter matcher > i.e. using the current behaviour where the block is passed the > parameters and the result of the block determines whether the > expectation matches. I''m planning on deprecating this soon. > - Anybody has a legitimate use for passing in an instance of Proc to > Expectation#returns i.e. using the current behaviour where the Proc > gets executed to generate a return value. I''m planning on deprecating > this soon as well. > > Thanks for all your ideas and suggestions. > > -- > James. > http://blog.floehopper.org > _______________________________________________ > mocha-developer mailing list > mocha-developer at rubyforge.org > http://rubyforge.org/mailman/listinfo/mocha-developer >-- Kevin Clark http://glu.ttono.us
Thanks for the helpful & positive feedback, Ned. -- James. http://blog.floehopper.org
On 4/12/07, Kevin Clark <kevin.clark at gmail.com> wrote:> > This looks awesome James. I now wish I''d submitted a Railsconf talk > about mocha instead of heckle (no love for the heckle these days :( ). > It just gets better and better. >Is it really too late? :-) I''ll be at RailsConf and would love to see a good Mocha presentation. Jeff
Jeff, Fraid so, but I''ll see if I can''t get some sort of video podcast going to show off the latest goodies. Kev On 4/14/07, Jeff Cohen <cohen.jeff at gmail.com> wrote:> On 4/12/07, Kevin Clark <kevin.clark at gmail.com> wrote: > > > > This looks awesome James. I now wish I''d submitted a Railsconf talk > > about mocha instead of heckle (no love for the heckle these days :( ). > > It just gets better and better. > > > > Is it really too late? :-) I''ll be at RailsConf and would love to see a > good Mocha presentation. > > Jeff > _______________________________________________ > mocha-developer mailing list > mocha-developer at rubyforge.org > http://rubyforge.org/mailman/listinfo/mocha-developer >-- Kevin Clark http://glu.ttono.us
On 4/14/07, Kevin Clark <kevin.clark at gmail.com> wrote:> > Jeff, > Fraid so, but I''ll see if I can''t get some sort of video podcast going > to show off the latest goodies. >That would be great. Thanks! Jeff
On 12/04/07, Kevin Clark <kevin.clark at gmail.com> wrote:> This looks awesome James. I now wish I''d submitted a Railsconf talk > about mocha instead of heckle (no love for the heckle these days :( ). > It just gets better and better. > > Kevin Clark > http://glu.ttono.usThanks for the positive feedback. -- James. http://blog.floehopper.org
On 15/04/07, Kevin Clark <kevin.clark at gmail.com> wrote:> Jeff, > Fraid so, but I''ll see if I can''t get some sort of video podcast going > to show off the latest goodies. > > Kev > -- > Kevin Clark > http://glu.ttono.usCool. Let me know if I can help :-) -- James. http://blog.floehopper.org
On 4/12/07, James Mead <jamesmead44 at gmail.com> wrote:> > I''ve finally managed to find some time to do some serious work on > Mocha. There are some code snippets on my blog > ( > http://blog.floehopper.org/articles/2007/04/12/preview-of-latest-mocha-changes > ) > showing the new functionality available in trunk (revision 128). I > don''t don''t know how many people out there are using trunk, but it > would be great to get some feedback on these changes before I make a > new release. >[snip] Any news on that new release? Jeff
On 02/06/07, Jeff Cohen <cohen.jeff at gmail.com> wrote:> Any news on that new release?I had hoped to do some more work before release, but it doesn''t look like I''m going to get round to it for a bit - I''ll try and get a release out tomorrow evening. Thanks for your interest. -- James. http://blog.floehopper.org
Don''t rush on account of me :-) Really, I was just curious, and I''m more than happy to use the trunk code for now. I''m just getting started with Mocha, so it''s not like I''m waiting on any particular feature. Thanks again. Jeff On 6/4/07, James Mead <jamesmead44 at gmail.com> wrote:> > On 02/06/07, Jeff Cohen <cohen.jeff at gmail.com> wrote: > > Any news on that new release? > > I had hoped to do some more work before release, but it doesn''t look > like I''m going to get round to it for a bit - I''ll try and get a > release out tomorrow evening. > > Thanks for your interest. > -- > James. > http://blog.floehopper.org > _______________________________________________ > mocha-developer mailing list > mocha-developer at rubyforge.org > http://rubyforge.org/mailman/listinfo/mocha-developer >