I am testing an API call to the server using Cucumber + Capybara with Selenium WebDriver.
I managed to get the response obj, but how do you assert that the response body contains
certain String? For example if the response body contains “Hello World” I want to assert that
this response body (Which is string) contains a pattern “World”
ex. Something like:
response = http.request(request)
response.body.should
have_text(“World”)
Alternatively is there a way to get “application/json” from the response and assert the contents using
Capybara?
Thanks!
I think what your looking for is
have_content.For more info, check out the README: Check out the documentation: https://github.com/jnicklas/capybara