[rspec-users] Documentation for Plain-Text Stories

Aslak Hellesøy aslak.hellesoy at gmail.com
Tue Aug 19 03:42:59 EDT 2008

On Aug 19, 2008, at 6:28 AM, Jim Morris wrote:

> aslak hellesoy wrote:
>> I'm inviting you to provide some constructive feedback about how we
>> could improve it to make the transition easier for people like
>> yourself.
> I'll give it a try, I'll port some of my stories to cucumber and see  
> how it goes.
>> A natural part of software evolution is that every now and then a
>> tool, library or program gets replaced by something better. While  
>> it's
>> certainly possible to maintain two different products, it takes a lot
>> more time. Time that I don't have. Am I to understand from your email
>> that you're stepping up and offering to help maintain and govern the
>> future of the story runner?
> True, but Story runner was only released in the last version of  
> RSpec so it isn't exactly old.

It was introduced in version 1.1.0 - about 8 months ago. That's not  
old I agree with you.

> Depending on how hard it is to port from story runner to cucumber,  
> I'll have to make a decision to either port, or maintain the old  
> code, it is a trade off of time. Right now I have my entire  
> integration testing suite written using story runner.

I would recommend that you keep using the story runner until the  
effort required to switch is so small that you can do it in an hour or  

> On an initial look at cucumber it looks like the steps remain pretty  
> much the same, although I see you added

They do remain pretty much the same, but I'm considering to move them  
from the toplevel scope and into classes (I prefer pure Ruby  
constructs instead of inventing our own cleverness).

class MySteps < Cucumber::Steps # Same as Story runnner steps_for(:my)
   Given /bla bla/ do

> Before and After, and I was using before story and after story  
> listeners for setup, not sure what scope the Before and After have.  
> I also use a before Scenario listener to clear the context before  
> each scenario.

Right now the scope of Before/After is global - i.e. all Before and  
After blocks will run before and after each scenario. I have  
deliberately postponed adding scoping of this until I better  
understand how people want to define this scoping.

Here is one ideas:

class MySteps < Cucumber::Steps # Same as Story runnner steps_for(:my)
   Before do
     # This block will run before all scenarios that use steps from  
     # Any scenarios not using any of these will not have this block run

   Given /bla bla/ do

I'm open to other ideas too.

In any case, a backwards compatible layer should be added so you can  
still use Scenario listeners if you wish.

>> What exactly is your understanding of deprecation and how have you
>> concluded that you will have rewrite several thousands of LOC?
> What I have seen in the Ruby world (and Java) is that deprecation  
> means the next release prints some warning that the feature is  
> deprecated if you use it, then the following release it is removed  
> entirely.
> I'll site the Ruby Gem Sequel as an example of some recent  
> deprecations, that caused me to go through many lines of code and  
> update them as the feature I was using was deprecated, and I  
> initially got a lot of warnings, then all my scripts stopped working  
> after an upgrade.

Don't worry. We'll keep it around inside RSpec for a while still. Only  
when we are confident that migration to Cucumber is painless will we  
take it out. At that point it will probably just be moved to a  
separate Git repo so those who wish can maintain it as a separate  

> Maybe I won't have to rewrite "thousands" of lines of code, at least  
> I hope not, if the steps remain the same, I guess I'll need to  
> massage them and rewrite many of the scenarios to fit the new format.

My goal is that you won't have to change anything at all, except  
perhaps the parts that deal with running stories (you'll get a Rake  
task and can delete your all.rb file). You shouldn't have to change  
the story/step files.

> I have to say my reaction is due to the fact that tests are  
> something you want to write once and forget, I don't mind writing  
> new tests using cucumber moving forward, but to have to revisit old  
> tests is not a good use of my time. If you were to reword  
> deprecation to frozen I'd be a lot happier :) then I can leave my  
> old tests alone and use cucumber for new tests.

Words are powerful aren't they :-)

Frozen is probably a better word. No more significant development on it.

Thanks a lot for your feedback - looking forward to more concrete ones  
so I can make Cucumber better.


> --
> Jim Morris, http://blog.wolfman.com
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users

More information about the rspec-users mailing list