未初始化的常量Gherkin :: Parser :: Parser(NameError)
我刚刚通过以下步骤将Cucumber添加到我的Rails应用程序中:
添加
group :test do
gem 'cucumber'
end
到我的Gemfile。
运行bundle install
随后通过rails generate cucumber:install
当没有特征时,黄瓜似乎按预期运行。
但是,当我添加一个功能文件并运行bundle exec cucumber
我得到以下内容
未初始化常量Gherkin :: Parser :: Parser(NameError)/Users/purinkle/.rvm/gems/ruby-1.9.3-p286@radfords/gems/cucumber-1.2.1/lib/cucumber/feature_file.rb:34: parse' /Users/purinkle/.rvm/gems/ruby-1.9.3-p286@radfords/gems/cucumber-1.2.1/lib/cucumber/runtime/features_loader.rb:28:in
block in load'/ Users /purinkle/.rvm/gems/ruby-1.9.3-p286@radfords/gems/cucumber-1.2.1/lib/cucumber/runtime/features_loader.rb:26:在each' /Users/purinkle/.rvm/gems/ruby-1.9.3-p286@radfords/gems/cucumber-1.2.1/lib/cucumber/runtime/features_loader.rb:26:in
加载'/Users/purinkle/.rvm/gems/ruby-1.9.3- p286@radfords/gems/cucumber-1.2.1/lib/cucumber/runtime/features_loader.rb:14:in features' /Users/purinkle/.rvm/gems/ruby-1.9.3-p286@radfords/gems/cucumber-1.2.1/lib/cucumber/runtime.rb:170:in
features中/Users/purinkle/.rvm/gems/ruby-1.9.3-p286@radfords/gems/cucumber-1.2.1/lib/cucumber/ runtime.rb:46:在run!' /Users/purinkle/.rvm/gems/ruby-1.9.3-p286@radfords/gems/cucumber-1.2.1/lib/cucumber/cli/main.rb:43:in
run!' /Users/purinkle/.rvm/gems/ruby-1.9.3-p286@radfords/gems/cucumber-1.2.1/lib/cucumber/cli/main.rb:43:in
execute!' /Users/purinkle/.rvm/gems/ruby-1.9.3-p286@radfords/gems/cucumber-1.2.1/lib/cucumber/cli/main.rb:20:in execute' /Users/purinkle/.rvm/gems/ruby-1.9.3-p286@radfords/gems/cucumber-1.2.1/bin/cucumber:14:in
“/Users/purinkle/.rvm/gems/ruby-1.9.3-p286@radfords/bin / cucumber:23:in load' /Users/purinkle/.rvm/gems/ruby-1.9.3-p286@radfords/bin/cucumber:23:in
:23:in'
你可能有其他一些实现Gherkin
宝石。
例如,如果您安装了spinach
,会产生冲突:当cucumber
需要Gherkin
,它会从spinach
宝石中取出,而不是从小gherkin
中取出
Cucumber
的Gherkin::Parser
是一个带有Parser
类的模块[1]。
Spinach
使用gherkin-ruby
[2],它以不同的方式实现整个事情,但使用相同的名称[3](实施不善的IMO)。
尝试卸载spinach
(从你的Gemfile
删除它,并且bundle update
应该足够了),或者你可能会导致名称冲突的任何东西。
上一篇: uninitialized constant Gherkin::Parser::Parser (NameError)