【问题标题】:Error when running bin/rails test in Vagrant在 Vagrant 中运行 bin/rails 测试时出错
【发布时间】:2017-08-10 02:42:56
【问题描述】:

我在 Vagrant 上运行 rails-dev-box,在盒子和我的 Windows 计算机之间共享一个文件夹。导轨版本 5.0.5。我有一个使用 sqlite3 数据库的非常基本的应用程序,以及一个为模型生成的基本脚手架。当我运行bin/rails test 时,我收到了这个错误:

ActiveRecord::Tasks::DatabaseAlreadyExists

this GitHub thread 中的链接指向this SO question,我关注了this answer - 我编辑了database.yml 以将数据库的位置更改为共享文件夹之外的位置。然后我使用bin/rails db:migrate 重新迁移了数据库。这似乎有点帮助,因为下次我运行bin/rails test 时收到了不同的错误:

正在等待迁移。要解决此问题,请运行: bin/rails db:迁移 RAILS_ENV=test

但即使在运行bin/rails db:migrate RAILS_ENV=test 之后,每次尝试运行测试时我仍然会收到此错误。

【问题讨论】:

    标签: ruby-on-rails testing activerecord vagrant


    【解决方案1】:

    我认为你需要的只是bin/rails db:test:prepare,然后是bin/rails test

    【讨论】:

      猜你喜欢
      • 2013-10-30
      • 1970-01-01
      • 2017-03-16
      • 1970-01-01
      • 1970-01-01
      • 2016-09-04
      • 2016-07-06
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多