[rspec-users] artificial sugar causes cancer

Nick Sieger nicksieger at gmail.com
Mon Nov 20 12:36:05 EST 2006

On 11/20/06, Olle Jonsson <olle at olleolleolle.dk> wrote:
> On Nov 20, 2006, at 4:00 PM, aslak hellesoy wrote:
> >> @bdd_framework.should_be_adopted_quickly #current
> >> @bdd_framework.should_be :adopted_quickly #proposed
> >>
> >
> > I prefer the latter too
> Dude +1, the latter is so preferred.

I'm mostly indifferent/favoring the proposed changes, but note that for the
above example, might it be confusing to drop the punctuation?

@bdd_framework.should_be :adopted_quickly vs @bdd_framework.should_be

I know it's the readability of the expectation here -- you're making a
statement, so you don't want it to end in a query, but the symbol-based
approach reminds me of using Object#send(:symbol), so there's a tiny bit of
magic in appending the query for you.  Perhaps the should_be helper could be
a special case that could use '.' or some other syntax for predicate

I also happen to like the underscore approach in the case of things like "
array.should_be_empty" to test for "array.empty? == true".  But I'd concede
that syntax if we could settle on something else.  Maybe I just need to
retrain my own eyes to be more accepting of "array.should_be :empty".  Is it
just me?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/rspec-users/attachments/20061120/420ddf3b/attachment-0001.html 

More information about the rspec-users mailing list