/features/deals_with_http_error_codes.feature

http://github.com/jnunemaker/httparty · Gherkin Specification · 26 lines · 22 code · 4 blank · 0 comment · 0 complexity · 50a9d0094bc2e2e64cfc1ac1e83810ca MD5 · raw file

  1. Feature: Deals with HTTP error codes
  2. As a developer
  3. I want to be informed of non-successful responses
  4. Because sometimes thing explode
  5. And I should probably know what happened
  6. Scenario: A response of '404 - Not Found'
  7. Given a remote service that returns a 404 status code
  8. And that service is accessed at the path '/404_service.html'
  9. When I call HTTParty#get with '/404_service.html'
  10. Then it should return a response with a 404 response code
  11. Scenario: A response of '500 - Internal Server Error'
  12. Given a remote service that returns a 500 status code
  13. And that service is accessed at the path '/500_service.html'
  14. When I call HTTParty#get with '/500_service.html'
  15. Then it should return a response with a 500 response code
  16. Scenario: A non-successful response where I need the body
  17. Given a remote service that returns a 400 status code
  18. And the response from the service has a body of 'Bad response'
  19. And that service is accessed at the path '/400_service.html'
  20. When I call HTTParty#get with '/400_service.html'
  21. Then it should return a response with a 400 response code
  22. And the return value should match 'Bad response'