Skip to content

Initialising guard-cucumber plugin fails with Error #42

Open
@s2k

Description

@s2k

Setup/Configuration/Environment

OS: macOS (11.1, Big Sur)
Ruby: 3.0.0 installed using rvm

Bundler:

$ bundler -v
Bundler version 2.1.4

Gemfile:

source 'https://rubygems.org'

ruby '3.0.0'

group :development do
  gem 'guard-cucumber', '~> 3.0.0'
  gem 'guard', '~> 2.16.2'
end

Behaviour

Initialising guard-cucumberfails with an error message:

$ bundle exec guard init guard-cucumber
12:24:16 - INFO - Writing new Guardfile to /Users/stephan/dev/fastfeedbackusingruby/tmp/Guardfile
12:24:17 - ERROR - Could not load 'guard/guard-cucumber' or '~/.guard/templates/guard-cucumber' or find class Guard::Guardcucumber
> [#]

A Guardfile is created, but without guard-cucumber specific content:

$ cat Guardfile
# A sample Guardfile
# More info at https://github.com/guard/guard#readme

## Uncomment and set this to only include directories you want to watch
# directories %w(app lib config test spec features) \
#  .select{|d| Dir.exist?(d) ? d : UI.warning("Directory #{d} does not exist")}

## Note: if you are using the `directories` clause above and you are not
## watching the project directory ('.'), then you will want to move
## the Guardfile to a watched dir and symlink it back, e.g.
#
#  $ mkdir config
#  $ mv Guardfile config/
#  $ ln -s config/Guardfile .
#
# and, you'll have to watch "config/Guardfile" instead of "Guardfile"

Observation

Reverting to the previous release of guard-cucumber using

gem 'guard-cucumber', '~> 2.1.2'

in the Gemfile instead of '3.0.0' works.
Since using the previous version of the plugin avoids the error _and creates a Cucumber related Guardfile, I presume this is in fact an issue with guard-cucumbernot Guard itself.

The Guardfile created with guard-cucumber 2.1.2:

$ cat Guardfile
# A sample Guardfile
# … skip comment lines 

cucumber_options = {
  # … skip comment lines 
}

guard "cucumber", cucumber_options do
  watch(%r{^features/.+\.feature$})
  watch(%r{^features/support/.+$}) { "features" }

  watch(%r{^features/step_definitions/(.+)_steps\.rb$}) do |m|
    Dir[File.join("**/#{m[1]}.feature")][0] || "features"
  end
end

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions