Greg Donald wrote:
It is my experience, and that of a large number
of other Rails developers, that using RSpec leads to more readable and
They both do the exact same thing. The assertion syntax is nearly
identical. RSpec just requires that you type a lot more to do the
that focus more on behavior and less on
implementation. �I don't see a single advantage of Test::Unit over RSpec
(except for the trivial one of its being included with Rails),
I personally don't see the need to type all that extra RSpec syntax
when I can type much simpler tests using Test::Unit.
I've never been able to write or seen anyone else write Test::Unit tests
that were actually readable and maintainable. RSpec's extra syntax
encourages a different style of test that is readable.
If RSpec were so
great, why is it still not the default, even with Rails3?
Who knows? I can't speak for the core team. My guess -- and it *is* a
guess -- is that it's because the Rails core team has a bad case of Not
Invented Here syndrome in some respects. This is nicely fed into by the
assumptions of many Rails developers that the core team's decisions are
perfect and needn't be questioned.
RSpec has huge advantages over Test::Unit as I outlined above, as well
as probably being more beginner-friendly.
What advantages? They both do the _exact same thing_, the main
difference is the syntax, one is smaller one is bigger.
Correct. The RSpec syntax encourages a different style of writing
with the one that requires less work.
So will I. That would be RSpec. The extra typing is trivial compared
to the advantage of actually having tests that don't require elaborate
deciphering 6 months later.
destiney.com | gregdonald.com