Fedor Fomenko
2009-Mar-13 08:36 UTC
[rspec-users] [cucumber] Using worlds for loading fixtures
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? -- Posted via http://www.ruby-forum.com/.
Joseph Wilk
2009-Mar-13 10:11 UTC
[rspec-users] [cucumber] Using worlds for loading fixtures
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. 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. 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) HTH -- Joseph Wilk http://blog.josephwilk.net
Pat Maddox
2009-Mar-13 10:37 UTC
[rspec-users] [cucumber] Using worlds for loading fixtures
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
aslak hellesoy
2009-Mar-13 11:17 UTC
[rspec-users] [cucumber] Using worlds for loading fixtures
On Fri, Mar 13, 2009 at 11:37 AM, Pat Maddox <pat.maddox at gmail.com> wrote:> 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 >How about this: http://rspec.lighthouseapp.com/projects/16211-cucumber/tickets/229-use-hooks-with-tags Aslak> > Pat > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >-- Aslak (::) -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20090313/eeec3ae5/attachment.html>