RAILS_ENV 与 Rails.env?为什么价值观不同?
我已经读过这个问题:Rails.env vs RAILS_ENV
我添加了rails-dev -boost 插件 (http://github.com/thedarkone/rails-dev-boost) 并且它内部使用 Rails.env.development?如果不是开发,则检查并绕过其脚本。这一般是没问题的。
但我也使用 Spork Testunit (http://github.com/timcharper/spork-testunit/) 启动测试服务器以快速运行测试。但这会导致问题并在运行测试时加载rails-dev-boost。我检查了rails-dev-boost插件的init.rb,它说:
Rails.env.development? # = true
RAILS_ENV # = "test"
为什么这些值不同?是否还有其他因素使这些值设置不同?有什么想法吗?
I have already read this question : Rails.env vs RAILS_ENV
I have added rails-dev-boost plugin (http://github.com/thedarkone/rails-dev-boost) and it internally uses Rails.env.development? to check and bypass its scripts if its not development. This is generally okay.
But I also use Spork Testunit (http://github.com/timcharper/spork-testunit/)to fire up a test server to quickly run tests. But this causes problem and loads up rails-dev-boost while running the tests. I checked within the rails-dev-boost plugin's init.rb and it says :
Rails.env.development? # = true
RAILS_ENV # = "test"
Why are these values different? Is there any other things that are settings these values different? Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在文档中:
In the documentation: