小编CRB*_*USA的帖子

新手黄瓜挂断了??成功?没有方法错误

所以我在"Pragmatic Cucumber"中的第一个项目,我在步骤定义中得到一个未定义的方法错误.错误来自$?成功?不用说我很困惑.我错过了什么宝石?

这是步骤定义

Given /^the input "(.*?)"$/ do |input|
  @input = input
end

When /^the calculator is run$/ do
  @output = 'ruby calc.rb #{@input}'
  raise('Command failed!') unless $?.success? #$?.success? is failing. look that up.
end

Then /^the output should be "(.*?)"$/ do |arg1|
  pending # express the regexp above with the code you wish you had
end
Run Code Online (Sandbox Code Playgroud)

这是错误.

Feature: Adding

  Scenario: Add two numbers       # features/adding.feature:3
Given the input "2+2"         # features/step_definitions/calculator_steps.rb:1
When the calculator is run    # features/step_definitions/calculator_steps.rb:5
  undefined …
Run Code Online (Sandbox Code Playgroud)

ruby ruby-on-rails cucumber

4
推荐指数
1
解决办法
2167
查看次数

标签 统计

cucumber ×1

ruby ×1

ruby-on-rails ×1