Rails Rails.configuration.xxx 在执行 rails test 的时候被认为是 nil

Unknow user · September 08, 2016 · 1102 hits

我在 config 文件夹下创建一个 xxx.yml 文件作为配置。然后通过 Rails.configuration.xxx[字段] 来获取配置。正常使用没问题,但是执行测试的时候报错,undefined method[]' for nil:NilClass (NoMethodError)`。

为什么测试的时候被当做 nil 了呢?

No Reply at the moment.
You need to Sign in before reply, if you don't have an account, please Sign up first.