Getting started with Cucumber

October 08, 2008

Cucumber is the new runner for Rspec plain text stories. It has a number of improvements that make it essential, and it will soon become the default runner for rspec. To get started we need to do a few things

  1. Install the gem

     sudo gem install cucumber
    
  2. Run the generator for each rails project you want to have cucumber in.

     script/generate cucumber
    
  3. Update my command in ~/.profile that runs rails projects in textmate to include the features folder, and source ~/.profile

      ## this is ~/.profile
      ...
      # edit this directory for rails projects (etdr)
      alias etdr='mate app config features lib db public spec stories test vendor/plugins &' 
    

Most importantly cucumber

  1. tells which matcher failed when a story fails
  2. throws an error if there are ambiguous matchers

Setting Up Textmate

Couple of bundles to install

cd ~/Library/Application\ Support/TextMate/Bundles                                                    
git clone git://github.com/bmabey/webrat-tmbundle.git Webrat.tmbundle  
git clone git://github.com/bmabey/cucumber-tmbundle.git Cucumber.tmbundle