Created
June 19, 2013 10:02
-
-
Save jmgarnier/5813179 to your computer and use it in GitHub Desktop.
When you need to truncate the test DB before each test, Zeus won't do it automatically. You need a custom plan for that: Run zeus init and then copy paste the following code.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'zeus/rails' | |
class CustomPlan < Zeus::Rails | |
def truncate_db | |
require 'database_cleaner' | |
DatabaseCleaner.clean_with :truncation | |
end | |
def test | |
if spec_file?(ARGV) && defined?(RSpec) | |
# disable autorun in case the user left it in spec_helper.rb | |
RSpec::Core::Runner.disable_autorun! | |
exit_code = RSpec::Core::Runner.run(ARGV) | |
truncate_db | |
exit exit_code | |
else | |
Zeus::M.run(ARGV) | |
end | |
end | |
end | |
Zeus.plan = CustomPlan.new |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks a lot !