Use RSpec, because it's great and the future System-file-manager rspec - suggested by Soleone, 3 months ago

If you’ve never heard of RSpec (which is really hard, because everyone is talking about it), let me give you a brief overview:

RSpec is for specifying and testing your code. This means you get nice HTML output, which tells you exactly what went wrong where in your code.

First you specify the behaviour of your code (e.g. your User model), like this:

So you start to write your specification first, then run it (which will fail in the beginning, because your model isn’t implemented yet), then begin to create your model after your specs.

This is a great approach because:

1. You see early how other users (and you too) will call your code. That means you can make the API slick and all.

2. All your code is backed up by tests. This means you can run your specs (aka tests), and instantly see if something somewhere fails. Believe me, after one month of pause on a project, this comes in really handy, when you try to modify/refactor some obscure code of yours.

For Rails there is very cool support with the official Rspec plugin

I seriously recommend you to look into RSpec, not just because I (and many others) like it, but because I think it will become standard for serious Ruby applications.

Applications-internet Go here for additional information: http://rspec.info/


0 Comments

Title (optional)

Text (Textile is active)


Back to all Tips