Going from Test::Unit to TTD with rspec


#1

Hi all,

I’ve been writing apps and using retrospectively written tests with
Test::Unit.

I want to get into TTD with rspec but all of the resources I’ve found
are either quite vague or out of date.

Can anyone point me to a good resource to get me started with TTD/rspec
in a rails app?

Something with some nice examples maybe, and something that tells you
how to actually run the tests would be great.

Thanks

Matt


#2

On Oct 5, 3:12 am, Matt H. removed_email_address@domain.invalid wrote:

Hi all,

I’ve been writing apps and using retrospectively written tests with
Test::Unit.

I want to get into TTD with rspec but all of the resources I’ve found
are either quite vague or out of date.

Can anyone point me to a good resource to get me started with TTD/rspec
in a rails app?

Not exactly what you asked, but you do realise that you can do TDD
with Test::Unit (or any testing framework really). It’s a shift in
mentality more than anything else. Some people like the language that
rspec uses, others don’t but that’s slightly orthogonal to whether
you’re TDD’ing or not

Fred


#3

Frederick C. wrote:

you do realise that you can do TDD
with Test::Unit (or any testing framework really). It’s a shift in
mentality more than anything else.

+1 to that.

I love and use RSpec (I never really learned Test::Unit). But if you
already know Test::Unit then I’d recommend that you try TDD with
Test::Unit. You can practice the workflow/mindset of writing a failing
test, then coding to make it pass (and then refactoring) without
having to learn new syntax at the same time.

To actually answer your question: I think the best place to learn
RSpec is the peepcode screencasts:
https://peepcode.com/products/rspec-basics

There are three of them. I couldn’t say which is best since I don’t
know how much you know about RSpec, but if you can afford $27 then you
should buy all three.

HTH


#4

DyingToLearn wrote:

test, then coding to make it pass (and then refactoring) without
having to learn new syntax at the same time.

Thats a very good point both of you have made, I guess I got pulled in
to the fact that most people like to use TTD with something other than
Test::Unit, but you’re both right, there doesn’t seem to be any reason
why I shouldn’t start working like this.

I will have a look at the screencasts some time but for now I will give
TTD and Test::Unit a shot :slight_smile:

Thanks for your input

Matt