Search code examples
ruby-on-railscucumberprybyebug

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


I've got a collision between the step 'pseudo function' provided by the byebug debugger (specifically, I'm using pry-byebug), and the step function provided by cucumber for running arbitrary cucumber steps.

I've tried to do my step function call with byebug's eval function, but this requires quotes to be nested three layers deep, and I haven't found a way to properly escape everything. For example, this doesn't work:

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

Solution

  • And no sooner have I typed up this question than I have found my own answer. So it goes!

    You can work around the step pseudo function with Ruby's internal send method, which is available on everything that inherits from object. Within the pry-debug REPL:

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