Allow users to disable database_cleaner hooks #232

merged 1 commit into from Mar 4, 2013


None yet

3 participants


Per the discussion in #215, this PR provides an option controlling the automatic invocation of DatabaseCleaner.start before every scenario, and DatabaseCleaner.clean afterwards (it defaults to true, naturally):

# features/support/env.rb
# ...
Cucumber::Rails::Database.autorun_database_cleaner = false

I added the option as an accessor on Cucumber::Rails::Database following the example of .javascript_strategy - it seemed the most natural place for it to live, but I'm happy to take alternative suggestions. :)


(p.s. the failing scenario is broken in master, too - wasn't me guv, honest.)


Code LGTM. Travis failed for an unrelated reason - we can no longer assume mongodb is running on a travis slave. Let's just disable the mongo test when running on Travis.

@urbanautomaton urbanautomaton Allow users to disable database_cleaner hooks
The hooks that automatically invoke database_cleaner before every
scenario can sometimes cause problems when switching cleaning strategies
between scenarios (issue #215).

To allow a user to take full control of when database_cleaner is
invoked, the configuration option
Cucumber::Rails::Database.autorun_database_cleaner is provided,
defaulting to true.
@Kosmas Kosmas merged commit 7c57290 into cucumber:master Mar 4, 2013

1 check passed

default The Travis build passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment