【问题标题】:Database cleaner not working with vim-rspec plugin数据库清理器不适用于 vim-rspec 插件
【发布时间】: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


    【解决方案1】:

    问题可能出在spring 本身,请将其删除并重试。您还可以查看.vimrc 文件中的g:rspec_command,也许您将任何特定脚本绑定到它?

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-01-03
      • 1970-01-01
      • 2012-09-28
      • 1970-01-01
      • 2014-02-14
      • 1970-01-01
      • 2014-10-19
      • 1970-01-01
      相关资源
      最近更新 更多