我已将 rspec 升级到 3.2 版,现在Mysql2::Error: Duplicate entry
运行规范时出现很多数据库错误 ()。这些规范似乎是并行运行的。我正在使用数据库清洁器 gem (1.4.1),它在升级之前就可以工作。怎么了?这是我的 spec_helper 文件:
Capybara.javascript_driver = :webkit
RSpec.configure do |config|
config.filter_run_excluding :broken => true
config.filter_run :focus => true
config.run_all_when_everything_filtered = true
config.infer_spec_type_from_file_location!
config.infer_base_class_for_anonymous_controllers = false
config.order = "random"
config.before(:suite) do
DatabaseCleaner.strategy = :truncation
DatabaseCleaner.strategy = :deletion, {except: %w[users]}
DatabaseCleaner.clean_with(:truncation)
end
config.before(:each) do
DatabaseCleaner.start
end
config.after(:each) do
DatabaseCleaner.clean
end
end