Closed JaniJegoroff closed 7 years ago
Based on the paths it looks like you are loading gherkin from two different places. Don't know what process is doing that but removing one should help resolve the error.
/usr/local/Cellar/ruby/2.1.5/lib/ruby/gems/2.1.0/gems/gherkin-3.2.0
/usr/local/lib/ruby/gems/2.1.0/gems/gherkin-3.2.0
So these errors appear when a gem can be found by multiple paths, one of which is a symlink to the other. It also occurs for systems where gems are reloaded, such as rspec/serverspec testing and rails.
Best practice is to always check for constant already being defined with conditional evaluation ala ||=
or unless const_defined?
If you google this phrase you'll find every other gem has fixed this problem. Would deeply appreciate a patch in 3.2.1 as a lot of testing tools are locked '~> 3.2.0'
--- lib/gherkin/dialect.rb_orig 2016-05-11 17:27:04.714712882 +0000
+++ lib/gherkin/dialect.rb 2016-05-11 17:23:01.926324245 +0000
@@ -1,8 +1,8 @@
require 'json'
module Gherkin
- DIALECT_FILE_PATH = File.expand_path("gherkin-languages.json", File.dirname(__FILE__))
- DIALECTS = JSON.parse File.read(DIALECT_FILE_PATH)
+ DIALECT_FILE_PATH ||= File.expand_path("gherkin-languages.json", File.dirname(__FILE__))
+ DIALECTS ||= JSON.parse File.read(DIALECT_FILE_PATH)
class Dialect
def self.for(name)
@charlierudolph FYI the two paths that @JaniJegoroff had above is the common symlink setup used by Brew on Macs, so this will affect many people
I'm seeing the problem when using bundler due to it's files and Ruby's habit of deferencing symlinks when storing the file load path.
I updated our test automation suite to use latest
cucumber 2.3.3
fromcucumber 1.3.19
. Everything is working fine locally but I noticed some warnings in the Jenkins CI logs:Gemfile:
Gemfile.lock
ruby 2.1.5p273 (2014-11-13 revision 48405) [x86_64-darwin13.0]