jayzes / cucumber-api-steps

Cucumber steps to easily test REST-based XML and JSON APIs

Repository from Github https://github.comjayzes/cucumber-api-stepsRepository from Github https://github.comjayzes/cucumber-api-steps

Usage with Rack

pmeinhardt opened this issue · comments

Hey, here's a quick fix for using the API steps with Rack. Before, all steps would fail because the JSON::Pure::Parser was initialized with a Rack::MockResponse which it couldn't handle:

# Monkey patch Rack::MockResponse to work with the cucumber API steps:
class Rack::MockResponse
  def to_str
    body
  end
end

I included this in my features/support/env.rb and though this might be worth sharing – maybe you can update the README or include the patch in the gem.

With kind regards,
Paul

Awesome, thanks! I'm in the process of setting up a test suite - I think there are a number of implicit cases regarding cucumber environment setup that I haven't really documented and/or fleshed out. Will pull this in one way or another.