开发者

How to access initializers constants from cucumber scenarios?

I have got a cucumber feature and when running it, I get the following error message:

uninitialized constant ApplicationController::CONFIG (NameError)
./app/controllers/application_controller.rb:25:in `xxx'

That 开发者_开发技巧CONFIG constant is a hash defined in config/initializers/config.rb. It is defined correctly when using the application in development/production mode but apparently it's not when called from a cucumber context.

I tried to add an initializer file in features/support with the following code:

Dir[Rails.root + "config/initializers/*.rb"].each do |file|
    require file
end

But it doesn't change anything.

What do you think about it?

Thanks


It seems Cucumber don't load your environment within your steps. What if you require your config files directly in features/steps?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜