Tic Tac Toe 2 – Initial code and story-driven class.

datePosted on 02:30, March 19th, 2009 by Peter Fitzgibbons

Episode 2: Using the story from the ground up.

I could go into great detail… but I’m beat.  Creating the dev environment from the ground up was a lot of work.  I also needed to get some project details under way.

Here is what I needed to get Features and Specs to load up the library properly

Cucumber

Create a cucumber.yml.  This is necessary to set the default profile, which I wanted to get a little more pretty printing during the cucumber command.

In a step definition (grid_steps.rb), I needed the $LOAD_PATH to point to the lib, so I added the following to the top of support/env.rb

$:.unshift File.expand_path(File.dirname(__FILE__) + "/../../lib")

Also support RSpec expectations/matchers within the steps, so

require 'spec/expectations'

RSpec

Update the $LOAD_PATH here from a different location in the tree than features, from ./spec

$:.unshift File.expand_path(File.dirname(__FILE__) + "/../lib")

Autotest integration

In order to get cucumber integrated with autotest, add this to cucumber.yml

autotest: --format pretty features
autotest-all: --format pretty features

Also autospec requires an environment switch, which I have added to ./bashrc for convenience

export AUTOFEATURE=true

Amber to Red to Green to Amber to Red to Green…

With all the prettyness set up with cucumber and RSpec, we now have a new color in the Red-Green cycle.

Cucumber Features’ Given/When/Then lines are displayed in Amber until each is properly trapped by a defined Given/When/Then in a steps definition file (./features/step_definitions/*.rb).

RSpec specs are displayed in amber if the spec is not defined (name only) like this

it "this spec is not defined yet"

Well, that’s about all I can handle for now.

I will make an attempt to trap the Amber-Red-Green cycle in git commits during my work tomorrow.

categoryPosted in Uncategorized
Related Posts:

Leave a Reply

Name: (required)
Email: (required) (will not be published)
Website:
Comment: