在Heroku上运行Rails单元测试 [英] Running Rails unit tests on Heroku
问题描述
我已经为Heroku部署了一个应用程序,并且一切正常。问题是我无法让我的单元测试远程运行。我试过了:
I've deployed an app to Heroku, and it all works fine. The problem is I can't get my unit tests running remotely. I've tried:
heroku rake test:units
和
and
heroku rake db:test:prepare
但是我得到一个巨大的堆栈跟踪,结尾是:
but for both I get a massive stack trace, ending with:
rake aborted!
undefined method `[]' for nil:NilClass
/app/[id]/home/.bundle/gems/ruby/1.9.1/gems/activerecord-3.0.3/lib/active_record/railties/databases.rake:429:in `block (3 levels) in <top (required)>'
/usr/ruby1.9.2/lib/ruby/1.9.1/rake.rb:634:in `call'
/usr/ruby1.9.2/lib/ruby/1.9.1/rake.rb:634:in `block in execute'
/usr/ruby1.9.2/lib/ruby/1.9.1/rake.rb:629:in `each'
/usr/ruby1.9.2/lib/ruby/1.9.1/rake.rb:629:in `execute'
我正在运行 bamboo-mri-1.9.2
堆栈。
到目前为止,我得到的答案最接近 2009年以来的这篇博客文章。
The closest I've got to an answer so far is this blog post from 2009.
推荐答案
Heroku不提供测试数据库,所以没有简单的方法来做到这一点。理论上讲,你可以创建一个新的heroku实例,并将rake任务破解为仅仅使用生产数据库,但我怀疑所需的努力是否值得。
Heroku doesn't provide a testing database, so there's no straightforward way to do that. You could theoretically create a new heroku instance and hack up the rake tasks to just use the 'production' database possibly, but I doubt the effort required would be worth it.
这篇关于在Heroku上运行Rails单元测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!