DatabaseCleaner清理测试和开发?

时间:2015-02-19 01:10:13

标签: ruby-on-rails ruby-on-rails-4 rspec database-cleaner

为什么此配置似乎清除了我的test和我的development数据库?每次运行development时必须重新设置rspec非常烦人。

config.before(:suite) do
  DatabaseCleaner.strategy = :transaction
  DatabaseCleaner.clean_with(:truncation)
end

的database.yml

development:
  adapter: postgresql
  database: m_development
  encoding: utf8
  pool: 5
  username: booltox
  password:

test:
  adapter: postgresql
  database: m_test
  encoding: utf8
  pool: 5
  username: booltox
  password:

1 个答案:

答案 0 :(得分:1)

我非常愚蠢,但这可能会帮助别人。不要忘记在 “$scope.getLink is not a function 中定义您的环境(感谢@dgilperez):

spec_helper.rb