Cucumber step definitions and dependencies in Gemfile
I would like to create step definitions for cucumber that depend on a range of gems. Cucumber does not seem to pick up the Gemfile when I put it in the same directory as the step definition. Running cucumber in verbose mode results in follow output:
I found that I could apply the solution that was provided for SO question: Bundler - load multiple Gemfiles.
This boils down to putting code in the Gemfile containing the cucumber dependency to enumerate all relevant Gemfiles in the folder structure where features and steps are (which could be customized even further) and evaluate them.
Bundler is able to process these as if they were part of the original Gemfile:
# Install gems from all subdirectories in <rootdir>
Dir.glob(File.join(File.dirname(__FILE__), 'rootdir', '**', "Gemfile")) do |gemfile|
eval(IO.read(gemfile), binding)
end
链接地址: http://www.djcxy.com/p/82616.html
下一篇: Gemfile中的黄瓜步定义和依赖关系