Exercises
We covered a lot of new material throughout this chapter, so to aid your understanding, I recommend doing the following exercises:
- Create a Ruby-based web service,
book-library
, to store books.
The acceptance criteria are delivered in the form of the following Cucumber feature:
Scenario: Store book in the library Given Book "The Lord of the Rings" by "J.R.R. Tolkien" with ISBN number "0395974682" When I store the book in library Then I am able to retrieve the book by the ISBN number
Proceed as follows:
- Write step definitions for the Cucumber test.
- Write the web service (the simplest way is to use the Sinatra framework (http://www.sinatrarb.com/), but you can also use Ruby on Rails).
- The book should have the following attributes:
name
,author
, and International Standard Book Number (ISBN
). - The web service should have the following endpoints:
POST /books
to add a bookGET...