Skip to content

Instantly share code, notes, and snippets.

@brycemcd
Last active January 30, 2016 02:27
Show Gist options
  • Save brycemcd/3e2957d839f6d20eb61c to your computer and use it in GitHub Desktop.
Save brycemcd/3e2957d839f6d20eb61c to your computer and use it in GitHub Desktop.
Using Padrino, database not clearing after each example

I was having a rough time making the test database use transactions when trying out Padrino recently. I added this line to my gemspec:

# Gemfile

group :test do
 # ... some gems
 gem 'database_cleaner'
 # ... some other gems
end

And then the following code to my spec_helper file and now the database runs transactionally as expected

# in the RSpec.configure block:
conf.around(:each) do |ex|
DatabaseCleaner.start
ex.run
DatabaseCleaner.clean
end
@Yorkshireman
Copy link

Cheers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment