如何在使用 pry-byebug 时调用 cucumber 'step' 方法?

How can you call the cucumber 'step' method while using pry-byebug?

我在 byebug 调试器(具体来说,我正在使用 pry-byebug)提供的 step 'pseudo function' 和 step 提供的函数之间发生了冲突黄瓜 运行 任意黄瓜步骤。

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

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

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

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

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