First attempting to use Capybara directly, you will ran into issues when trying to set HTTP header. Using Basic HTTP Authentication requires that we needed to set the header. Also we need to set the Content-Type and Accept headers to ensure that Rails handles the input and output correctly. When using Rack, Capybara delegates request and response handling down to Rack::Test. So I used Rack::Test directly in my step definitions, and it works. Rack::Test has a module called Rack::Test::Methods that can be mixed into a class to provide it with methods for get, post, put, delete as well as last_request, last_response, header and more. I mixed Rack::Test::Methods into the Cucumber world at the top of our API steps file like so: