[rspec-users] Sample App - TDD with Cucumber and RSpec
ashley.moran at patchspace.co.uk
Tue Dec 2 07:40:16 EST 2008
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
strikes me more of a when step, eg
When /^all posties are destroyed$/ do
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.
More information about the rspec-users