Search code examples
rubyjenkinscucumberrakehudson

NoMethodError: undefined method `initializer' for Cucumber:Module


I am trying to run some cucumber tests using rake. When I call rake kickoff (@kickoff is the tag within my feature file) I get the following error:

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)

I have already run bundler and all necessary gems are installed.

Here is the contents of my kickoff_build feature file:

@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

Here is the content of my 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

Solution

  • This is a bug present in the betas for cucumber 2.0.0.

    Upgrade to cucumber ~> 2.0 and you should be fine.