Rails 3、RSpec 2 和 Cucumber 产生错误数量的参数(1 为 3)(ArgumentError)

发布于 2024-09-09 17:28:02 字数 1761 浏览 2 评论 0原文

我主要遵循以下说明来让事情运转起来: http: //lindsaar.net/2010/5/9/Getting-Rails-3-Edge-with-jQuery-RSpec-and-Cucumber-using-RVM

如果我创建一个完全空白的 .feature 文件,运行 Cucumber 结果在这个错误中:

黄瓜

参数数量错误(1 为 3) (参数错误) /gems/gherkin-2.0.2/lib/gherkin/parser/parser.rb:125:in <代码>扫描' /gems/gherkin-2.0.2/lib/gherkin/parser/parser.rb:125:in transition_table' /gems/gherkin-2.0.2/lib/gherkin/parser/parser.rb:112:in build_transition_map' /gems/gherkin-2.0.2/lib/gherkin/parser/parser.rb:108:intransition_map' /gems/gherkin-2.0.2/lib/gherkin/parser/parser.rb:75:in 初始化' /gems/gherkin-2.0.2/lib/gherkin/parser/parser.rb:52:in新' /gems/gherkin-2.0.2/lib/gherkin/parser/parser.rb:52:in push_machine' /gems/gherkin-2.0.2/lib/gherkin/parser/parser.rb:20:in初始化' /gems/cucumber-0.8.3/bin/../lib/cucumber/feature_file.rb:32:in <代码>新' /gems/cucumber-0.8.3/bin/../lib/cucumber/feature_file.rb:32:in 解析' /gems/cucumber-0.8.3/bin/../lib/cucumber/step_mother.rb:62:in load_plain_text_features' /gems/cucumber-0.8.3/bin/../lib/cucumber/step_mother.rb:60:in每个' /gems/cucumber-0.8.3/bin/../lib/cucumber/step_mother.rb:60:in load_plain_text_features' /gems/cucumber-0.8.3/bin/../lib/cucumber/cli/main.rb:55:in 执行!' /gems/cucumber-0.8.3/bin/../lib/cucumber/cli/main.rb:25:in <代码>执行' /gems/黄瓜-0.8.3/bin/黄瓜:8 /bin/cucumber:19:in加载' /bin/黄瓜:19

有趣的是,如果我注释掉 features/support/env.rb 文件,我不会收到错误。但这对我没有多大好处。我可以成功运行该网站(它是空的)。谁能想到为什么环境代码会杀死小黄瓜解析器?我对此有点陌生,不知道下一步该往哪里看。

谢谢。 -杰夫

I mostly followed these instructions to get things spun up:
http://lindsaar.net/2010/5/9/Getting-Rails-3-Edge-with-jQuery-RSpec-and-Cucumber-using-RVM

If I create a completely blank .feature file, running cucumber results in this error:

cucumber

wrong number of arguments (3 for 1)
(ArgumentError)
/gems/gherkin-2.0.2/lib/gherkin/parser/parser.rb:125:in
scan'
/gems/gherkin-2.0.2/lib/gherkin/parser/parser.rb:125:in
transition_table'
/gems/gherkin-2.0.2/lib/gherkin/parser/parser.rb:112:in
build_transition_map'
/gems/gherkin-2.0.2/lib/gherkin/parser/parser.rb:108:in
transition_map'
/gems/gherkin-2.0.2/lib/gherkin/parser/parser.rb:75:in initialize'
/gems/gherkin-2.0.2/lib/gherkin/parser/parser.rb:52:in
new'
/gems/gherkin-2.0.2/lib/gherkin/parser/parser.rb:52:in push_machine'
/gems/gherkin-2.0.2/lib/gherkin/parser/parser.rb:20:in
initialize'
/gems/cucumber-0.8.3/bin/../lib/cucumber/feature_file.rb:32:in
new'
/gems/cucumber-0.8.3/bin/../lib/cucumber/feature_file.rb:32:in
parse'
/gems/cucumber-0.8.3/bin/../lib/cucumber/step_mother.rb:62:in
load_plain_text_features'
/gems/cucumber-0.8.3/bin/../lib/cucumber/step_mother.rb:60:in
each'
/gems/cucumber-0.8.3/bin/../lib/cucumber/step_mother.rb:60:in
load_plain_text_features'
/gems/cucumber-0.8.3/bin/../lib/cucumber/cli/main.rb:55:in
execute!'
/gems/cucumber-0.8.3/bin/../lib/cucumber/cli/main.rb:25:in
execute'
/gems/cucumber-0.8.3/bin/cucumber:8
/bin/cucumber:19:in
load'
/bin/cucumber:19

Interestingly, if I comment out the features/support/env.rb file, I do not get the error. That doesn't do me much good though. I can run the site successfully (It's empty). Can anyone think of why the env code would kill the gherkin parser? I'm a little too new at this to know where to look next.

Thanks.
-Jeff

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

哭了丶谁疼 2024-09-16 17:28:02

这位有没有帮我解答一下。这是最新的黄瓜和小黄瓜之间的不相容。需要将我的 gemfile 更改为:

gem“cucumber”
宝石“小黄瓜”,“= 2.1.4”
宝石“黄瓜导轨”

Has this one answered for me. It's an incompatibility between the latest cucumber and gherkin. Needed to alter my gemfile to:

gem "cucumber"
gem "gherkin", "= 2.1.4"
gem "cucumber-rails"

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文