NoMethodError: undefined method `initializer' for Cucumber:Module

NoMethodError: undefined method `initializer' for Cucumber:Module

我正在尝试 运行 使用 rake 进行一些黄瓜测试。当我调用 rake kickoff(@kickoff 是我的功能文件中的标记)时,出现以下错误:

rake aborted!
NoMethodError: undefined method `initializer' for Cucumber:Module
/webdata/jenkins/jobs/kickoff_build/workspace/Rakefile:2:in `<top (required)>'
(See full trace by running task with --trace)

我已经 运行 捆绑器并安装了所有必要的 gem。

这是我的 kickoff_build 特征文件的内容:

@kickoff

Feature: Automated Regression Build
  Scenario: As an automation developer, I want to kick off the build
    Given the CI server is configured correctly
    When the tag in line 1 of this file is called via a rake task
    Then this test should run and pass

这是我的Rakefile的内容:

require 'rubygems'
require 'cucumber'
require 'cucumber/rake/task'
require 'cuke_sniffer'

Cucumber::Rake::Task.new(:kickoff, :build) do |t|
  tags = '--tags ~@wip --tags ~@manual --tags ~@known_defect'
  t.cucumber_opts = "--format html --out results/result.html --format pretty #{tags} --format junit --out features/reports"
end

这是黄瓜 2.0.0 测试版中存在的错误。

升级到黄瓜~> 2.0,你应该没问题。