Just switched from Cucumber+Webrat to Cucumber+Capybara and I am wondering how you can POST content to a URL in Capybara.
In Cucumber+Webrat I was able to have a ste
As others have said, there’s no direct way of doing a POST with Capybara because it’s all about browser interaction. For API testing, I’d very highly recommend the rspec_api_documentation gem.
You could do this:
rack_test_session_wrapper = Capybara.current_session.driver
rack_test_session_wrapper.submit :post, your_path, nil
:post
which whatever method you care about e.g. :put
or :delete
.your_path
with the Rails path you want e.g. rack_test_session_wrapper.submit :delete, document_path(Document.last), nil
would delete the last Document in my app.