I'd actually like to know the answer to that one.  What is the reason for
enclosing the rspec test case in a lamda?  Is it because you don't want the
exception actually raised in the test case but raised in another context
then observed?

On Wed, Oct 28, 2009 at 12:36 AM, Aldric Giacomoni <aldric / trevoke.net>wrote:

> Aldric Giacomoni wrote:
> > Marnen Laibow-Koser wrote:
> >>
> >> In Rails they're occasionally used for callbacks, and in
> >> RSpec I often do things like
> >> lambda {Car.drive}.should_not raise_error
> >>
> >> See http://en.wikipedia.org/wiki/Closure_(computer_science)<http://en.wikipedia.org/wiki/Closure_%28computer_science%29>for more.
> >
> > I'm reading that wiki page right now ;-)
> > About that RSpec example..
> >
> > You are creating "code which calls Car.drive", yes ? Why not just call
> > Car.drive ? That is the main bit of thinking I'm having issues with.
>
> Never mind!
> I just found this : http://innig.net/software/ruby/closures-in-ruby.rb
> Enlightening. Thanks again for your help, it makes it all easier to
> read.
> --
> Posted via http://www.ruby-forum.com/.
>
>