On Mar 13, 2009, at 3:11 AM, Joseph Wilk wrote:

Fedor Fomenko wrote:
What is the right place to load fixtures specific to a given scenario? I was thinking of using Worlds. Is it the right place for loading/ deleting
fixtures? How do I specify which world scenario should run in?

There 3 options I can think of:

1. Background Feature
This allows you to specify specific set of steps which are only run for the scenarios in the relevant feature (http://wiki.github.com/aslakhellesoy/cucumber/background ). I would recommend this approach if you are using the latest cucumber version from github.

Makes sense if it applies to every scenario within a feature.


2, In the scenario
Are you hiding state setup which would be better placed in the plain text scenario? You don't have to get too granular with the data setup, a high level "Given the system is setup...." style could be used to avoid noise that detracts from the scenario value.

What I do 99% of the time.


3. Before
If you do this in a Before you can gain access to the scenario name (http://rspec.lighthouseapp.com/projects/16211-cucumber/tickets/44 ). You could switch this to run the relevant fixture if you wish. (This is a bit smelly)

You could clean it up: http://gist.github.com/78518 but it's still horrible :P

Pat
_______________________________________________
rspec-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to