News for hackers. Stuff that matters.
Re:Ruby Test::Unit sucks (and why I still use it) by dchelimsky on Sunday December 19, 2010 @09:30AM (#2021715)
RSpec 2 introduced an eq matcher so you can do this warning free:

    i.porkchop_sandwiches.count.should eq(1).
Then for object identity you can still use be:

    i.porkchop_sandwiches.first.should be(my_sandwich)
This is actually more in line with the original RSpec, which had should_equal and should_be, and I prefer it because you eliminate the warning, and (I think that) "1.should eq(1)" actually speaks better than "1.should == 1" for someone familiar with ruby but new to RSpec.
Re:Ruby Test::Unit sucks (and why I still use it) by petercooper on Sunday December 19, 2010 @05:55PM (#2022762)
Fair enough, though I know what == means in Ruby and eq is additional, duplicated syntax to learn (as with assert_equals). Without hitting the docs, I wonder what the other comparisons are in this alternate DSL. I could have a good guess.. lt, gt.. not sure on less than or equal to, regex matching, etc. I'd have to look up or memorize those rather than use syntax reinforced over years of use that already does the job. How something sounds is not so important to me, AppleScript swore me off the "sounds like English" route :-)

Naturally this is a matter of opinion, but it's testament to your fine work with RSpec (and particularly in the recent modularization work) that it deals deftly with differing opinions without putting anyone at a serious disadvantage.

Re:Ruby Test::Unit sucks (and why I still use it) by dchelimsky on Sunday December 19, 2010 @10:41PM (#2023227)
Thanks for the props.

The other operators are still supported as/is and don't cause the warning that == does.