In-Process Testing of Rack-Based REST APIs
Let’s start with the first approach, where both Cucumber and your application run in the same Ruby process. We’ll be dealing with a very simple REST API for storing and retrieving fruit. It’s probably not the most useful system in the world but should allow us to illustrate the fundamentals of REST and Cucumber.
We’re going to build our web service from scratch. Create a new project with a features directory in it, and create this file:
rest_web_services/00/features/fruit_list.feature | |
| Feature: Fruit list |
| In order to make a great smoothie |
| I need some fruit. |
| |
| Scenario: List fruit |
| Given the system knows about the following fruit: |
| | name | color | |
| | banana | yellow | |
| | strawberry ... |
Get The Cucumber Book now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.