On 2 Dec 2008, at 08:04, Pau Cor wrote:

Given /^there are no (.*)$/ do |thing|

I really like that. It will make it much more clear since "Given there
are no" will be a very common step.

Hmmm, I personally think it's safer to set up each scenario from a blank slate. I've used "Given there are no X" steps before, but they are just stubs to make the scenario read right, ie they simply don't create anything, rather than destroying existing data.

The current implementation,
  Given /^there are no posties$/ do
    Postie.destroy_all
  end

strikes me more of a when step, eg
  When /^all posties are destroyed$/ do
    Postie.destroy_all
  end

A Before block to destroy the Posties (and any other models) will probably reduce issues in the long run if Postie began to depend on another object, and was trapped by a database constraint.

Ashley

--
http://www.patchspace.co.uk/
http://aviewfromafar.net/



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

Reply via email to