【问题标题】:How can you call the cucumber 'step' method while using pry-byebug?使用 pry-byebug 时如何调用黄瓜的“步骤”方法?
【发布时间】:2015-03-23 18:35:42
【问题描述】:

byebug 调试器(具体来说,我正在使用 pry-byebug)提供的 step“伪函数”与 cucumber 提供的用于运行任意 cucumber 步骤的 step 函数之间存在冲突。

我尝试使用 byebug 的 eval 函数调用我的 step 函数,但这需要将引号嵌套三层,而且我还没有找到正确转义所有内容的方法。例如,这不起作用:

eval "step(\"I click on the \"Save order\" form button\")"

【问题讨论】:

    标签: ruby-on-rails cucumber pry byebug


    【解决方案1】:

    我刚输入这个问题,就找到了自己的答案。就这样吧!

    您可以使用 Ruby 的内部 send 方法解决 step 伪函数,该方法可用于从对象继承的所有内容。在 pry-debug REPL 中:

    self.send 'step', 'I click on the "Save order" form button'
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-02-08
      • 2017-11-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多