【发布时间】:2015-02-22 10:30:13
【问题描述】:
我使用 vim-rspec 插件能够在 vim 中运行 rspec 测试,到目前为止它运行良好。但突然database_cleaner gem 停止工作。
这是我的配置:
# spec/rspec_rails.rb
Rspec.configure do |config|
config.before(:suite) do
puts "Setting up the database cleaner."
DatabaseCleaner.strategy = :transaction
DatabaseCleaner.clean_with(:truncation)
end
config.around(:each) do |example|
puts "Cleaning the database"
DatabaseCleaner.cleaning do
example.run
end
end
end
我把这两条消息放出来看看这两个块是否运行。但他们没有。即使我停止spring 然后我再次运行它也不会纠正它。奇怪的是,如果我从命令行运行rspec 命令,一切都会正常运行,并且我会清理消息和数据库,第一次运行时,第二次运行示例。
【问题讨论】:
标签: ruby ruby-on-rails-4 vim rspec database-cleaner