Topic: upgrade instructions for rspec stories 1.1.4/regex gotcha

WHOOPS--this post should be in the Testing forum.

After a late-night svn snafu, I accidently upgraded from rspec 1.1.3 to 1.1.4, and found my tests wouldn't run anymore (all steps pending). 

After Googling this I found one of the rspec programmers had put up this pastie to explain the upgrade changes:

Basically, you have to do this to upgrade your files:

1) Change the steps parameter in the story set up:

Story "Basic Idea", "User Payoff", :type=>RailsStory, :steps_for => :some_steps do

instead of

Story "Basic Idea", "User Payoff", :type=>RailsStory, :steps => do

2) In your steps class file, get rid of the SomeSteps class by deleting the class declaration and last "end." Leave the steps and steps declaration.

3) Replace the steps declaration

steps_for :some_steps do

instead of

steps do |define|

4) Search and replace:

define.given => Given
define.when => When
define.then => Then

5) You should also get rid of the argument parentheses in the old style:

define.given("a user named $name") do |name|

But being lazy I left these in. This was not a problem EXCEPT for scenarios involving regex:

Given /(a|.*Chat) $name chat with $min to $max members/ do |chat_type, name, min, max|

These do not work with parentheses.

Last edited by Matt Garland (2008-09-18 18:10:30)