当试图在
database_cleaner的
GitHub page上关注示例时,我从RSpec遇到以下错误:
ActiveRecord::StatementInvalid: sqlite3::sqlException: cannot start a transaction within a transaction: begin transaction
spec_helper.rb中使用的配置是:@H_301_5@
require 'spork' require 'database_cleaner' Spork.prefork do # .. snip RSpec.configure do |config| # .. snip config.before(:suite) do DatabaseCleaner.strategy = :transaction DatabaseCleaner.clean_with(:truncation) end config.before(:each) do DatabaseCleaner.start end config.after(:each) do DatabaseCleaner.clean end end end Spork.each_run do end