RailsCasts Pro episodes are now free!

Learn more or hide this

Matthias Jaros's Profile

GitHub User: mjaros

Site: www.mjaros.com

Comments by Matthias Jaros

Avatar

I had to use database_cleaner to clean up my testing database before each test:

ruby
require 'database_cleaner'

DatabaseCleaner.strategy = :truncation
class MiniTest::Spec
  before :each do
    DatabaseCleaner.clean
  end
end

This does not use transactions, although it should be possible somehow with database_cleaner. They have an RSpec example on their GitHub page which maybe could work.

Avatar

Ryan could have done this because it's more Ruby 1.9 to omit the hash rocket now and personally I think his syntax is looking cleaner.
But you're right that the as: option is unnecessary.