making the world a stranger place

Site menu:

Archives

Links:

Amazon Ad

Tags

Meta

model_stubbing makes testing easy

Jeremy McAnally has a post about model_stubbing that pretty much explains how to do what you need to do in your test to use it. It’s a pretty meaty post, and has a couple of tricks in it, so if you’re dying from fixture usage, check it out at omgbloglol.com.

Tags: , , , , , , ,

RSpec Stories On Rails

Congrats on Passing that Test SuiteUsing a story to drive your development tasks is a good idea, even when there is only 1 team member. Writing stories helps you stay focused on the requirements without getting side-tracked into something that isn’t working toward the end goal of your app. There’s always time for script.aculo.us later! Using RSpec stories also means you have tests to run against your code so you know that fixing something probably didn’t break something else.

First thing you want to do is get the RSpec on Rails plugin installed, and generate the RSpec code.

$ ./script/plugin install git://github.com/dchelimsky/rspec.git
$ ./script/plugin install git://github.com/dchelimsky/rspec-rails.git
$ ./script/generate rspec

Stories are broken down into 2.5 files:

  • 1. The Story file - Where the plain text story resides
  • 2. The Step file - Where the different steps in your story are defined.
  • 2.5 The Story runner file - The ruby code that kicks everything off.

Read more »

Tags: , , , , , ,