I've got fixtures that I want for all my scenarios. I've got the
following in my env.rb:
Spork.each_run do
require 'cucumber/rails/world'
Cucumber::Rails::World.use_transactional_fixtures = true
ActionController::Base.allow_rescue = false
fixtures = Fixtures.create_fixtures("spec/fixtures",
"config_spaces")
at_exit do
fixtures.delete_existing_fixtures
end
end
Yet the fixtures are not being deleted at the end of my cucumber run.
Nor are they deleted at the time I kill the spork server.
Thats correct. I think Tim's suggestion of adding a "between_run" hook
to spork is the best option. So you might have something like:
def cleanup
...
end
at_exit do
cleanup
end
Spork.between_run do
cleanup
end
WDYT? (If you like it you may want to open/vote up an issue on Spork's
github tracker.)
> Doing cleanup on startup is no good, because rspec uses the same
> database and it doesn't expect there to be garbage sitting around.
>
>
Until a between_run hook is added to Spork then I think you will need to
work around this issue. Meaning, you will need to do cleanup in both
rspec and cucumber on startup OR use a different database.
HTH,
Ben