Sprinkling my examples with ''lambda'' has always seemed like a bit of a wart to me. I''ve gotten into the habit of adding ''alias :calling :lambda'' to my spec suites. My examples then look like: calling { Foo }.should raise_error calling { Bar }.should_not raise_error Is there a reason that RSpec core has chosen not to make exception expectations more sugary?
On 9/19/07, Jed Hurt <jed.hurt at gmail.com> wrote:> Sprinkling my examples with ''lambda'' has always seemed like a bit of a > wart to me. I''ve gotten into the habit of adding ''alias :calling > :lambda'' to my spec suites. My examples then look like: > > calling { Foo }.should raise_error > calling { Bar }.should_not raise_error > > Is there a reason that RSpec core has chosen not to make exception > expectations more sugary? > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >There''s actually a ticket that aliases it to running, I believe. So specs would look like running { Foo }.should raise_error Pat
On Sep 19, 2007, at 10:17 PM, Jed Hurt wrote:> Sprinkling my examples with ''lambda'' has always seemed like a bit of a > wart to me. I''ve gotten into the habit of adding ''alias :calling > :lambda'' to my spec suites. My examples then look like: > > calling { Foo }.should raise_error > calling { Bar }.should_not raise_error > > Is there a reason that RSpec core has chosen not to make exception > expectations more sugary?There was a long discussion of this in the tracker + mailing list. Did you not see it (It almost seems coincidental that you ask this question at the current time). Scott
On 9/19/2007 11:04 PM, Scott Taylor wrote:> On Sep 19, 2007, at 10:17 PM, Jed Hurt wrote: > >> Sprinkling my examples with ''lambda'' has always seemed like a bit of a >> wart to me. I''ve gotten into the habit of adding ''alias :calling >> :lambda'' to my spec suites. My examples then look like: >> >> calling { Foo }.should raise_error >> calling { Bar }.should_not raise_error >> >> Is there a reason that RSpec core has chosen not to make exception >> expectations more sugary? > > There was a long discussion of this in the tracker + mailing list. > Did you not see it (It almost seems coincidental that you ask this > question at the current time).Yes, that is *quite* a coincidence, Mr. Jed Hurt - IF that is your real name... Seriously, check out http://rubyforge.org/tracker/index.php?func=detail&aid=13837&group_id=797&atid=3152 Jay
I missed that one. I had a feeling that such a discussion must have already taken place, so I sent this suggestion with some trepidation. Having read the tracker comments, I empathize with David''s and Aslak''s sentiments. On 9/19/07, Jay Levitt <lists-rspec at shopwatch.org> wrote:> On 9/19/2007 11:04 PM, Scott Taylor wrote: > > On Sep 19, 2007, at 10:17 PM, Jed Hurt wrote: > > > >> Sprinkling my examples with ''lambda'' has always seemed like a bit of a > >> wart to me. I''ve gotten into the habit of adding ''alias :calling > >> :lambda'' to my spec suites. My examples then look like: > >> > >> calling { Foo }.should raise_error > >> calling { Bar }.should_not raise_error > >> > >> Is there a reason that RSpec core has chosen not to make exception > >> expectations more sugary? > > > > There was a long discussion of this in the tracker + mailing list. > > Did you not see it (It almost seems coincidental that you ask this > > question at the current time). > > Yes, that is *quite* a coincidence, Mr. Jed Hurt - IF that is your real > name... > > Seriously, check out > > http://rubyforge.org/tracker/index.php?func=detail&aid=13837&group_id=797&atid=3152 > > Jay > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >