NoMethodError:Cucumber:Module的未定义方法`initializer'

时间:2015-07-10 19:06:01

标签: ruby jenkins cucumber rake hudson

我正在尝试使用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)

我已经运行了bundler并安装了所有必需的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

1 个答案:

答案 0 :(得分:0)

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

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