Re: [rspec-users] Testing return value of a block argument

2009-03-22 Thread Mark Wilden
On Mon, Mar 16, 2009 at 4:00 AM, Yun Huang Yong wrote: > > Is there any way to test what the resultant log message is from evaluating > the block? > > i.e. something like: >  log_mock.should_receive(:debug) { |log_block| >    # execute log_block, and check its return value >  } Sorry - I don't qu

Re: [rspec-users] Testing return value of a block argument

2009-03-22 Thread David Chelimsky
On Sun, Mar 22, 2009 at 10:33 AM, Peter Jaros wrote: > Going forward, what do people think about being able to say > > mock.should_receive(:debug).with_block  { |log_block| >  # execute log_block, and check its return value >  } > > Thoughts? I like the idea, but I don't know how well it will pla

Re: [rspec-users] Testing return value of a block argument

2009-03-22 Thread Peter Jaros
Going forward, what do people think about being able to say mock.should_receive(:debug).with_block { |log_block| # execute log_block, and check its return value } Thoughts? Peter On Sat, Mar 21, 2009 at 8:25 PM, Mark Wilden wrote: > On Mon, Mar 16, 2009 at 4:00 AM, Yun Huang Yong wrote:

Re: [rspec-users] Testing return value of a block argument

2009-03-21 Thread Mark Wilden
On Mon, Mar 16, 2009 at 4:00 AM, Yun Huang Yong wrote: > > i.e. something like: >  log_mock.should_receive(:debug) { |log_block| >    # execute log_block, and check its return value >  } I suppose you could always look at the source code for the debug method, find out what it does with the result

Re: [rspec-users] Testing return value of a block argument

2009-03-21 Thread Guilherme Machado Cirne
I have this exact same problem. Anyone have a solution? TIA, -- Guilherme Machado Cirne gci...@gmail.com On Mon, Mar 16, 2009 at 8:00 AM, Yun Huang Yong wrote: > Hi, > > I'm using Log4r and one of its neat features is its handling of blocks such > that you can do: > log.debug { "Something b

Re: [rspec-users] Testing return value of a block argument

2009-03-16 Thread Matt Wynne
On 16 Mar 2009, at 11:00, Yun Huang Yong wrote: I'm using Log4r You might want to check out this library, which seems to be better maintained these days: http://github.com/TwP/logging/tree/master Matt Wynne http://blog.mattwynne.net http://www.songkick.com __

Re: [rspec-users] Testing return value of a block argument

2009-03-16 Thread Mark Wilden
On Mon, Mar 16, 2009 at 8:33 AM, Nick Hoffman wrote: >> >> Is there any way to test what the resultant log message is from evaluating >> the block? >> >> i.e. something like: >>  log_mock.should_receive(:debug) { |log_block| >>    # execute log_block, and check its return value >>  } > > Hi Yun. H

Re: [rspec-users] Testing return value of a block argument

2009-03-16 Thread Nick Hoffman
On Mon, Mar 16, 2009 at 7:00 AM, Yun Huang Yong wrote: > Hi, > > I'm using Log4r and one of its neat features is its handling of blocks such > that you can do: >  log.debug { "Something bad happened" + some_expensive_method() } > instead of: >  log.debug("Something bad happened" + some_expensive_m

[rspec-users] Testing return value of a block argument

2009-03-16 Thread Yun Huang Yong
Hi, I'm using Log4r and one of its neat features is its handling of blocks such that you can do: log.debug { "Something bad happened" + some_expensive_method() } instead of: log.debug("Something bad happened" + some_expensive_method()) The benefit of the former is that some_expensive_metho