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 <y...@nomitor.com> 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_method())
>
> The benefit of the former is that some_expensive_method() is not executed
> until the debug() method executes so if your log level doesn't include DEBUG
> you don't suffer the performance hit of calling some_expensive_method()
> needlessly.
>
> 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
>  }
>
> I have a simple bit of code to tinker with: http://gist.github.com/79820
>
> Thanks in advance,
> yun
>
> --
> Yun Huang Yong
> y...@nomitor.com                  ...nom nom nom
> --
> _______________________________________________
> rspec-users mailing list
> rspec-users@rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to