Sinatra Part: Test (Specs)
It is surprising that you include tests in this work. OTOH that is really great because it shows how much testing is considered automatic nowadays. OTOH testing is a tricky business.
You have chosen RSpec as a framework and that is a mainline choice. So much mainline that I am afraid it is almost a must to follow certain conventions. These conventions are, at least:
specdirectory per app/lib.
specto assure maximum consistency for loaded libs, environment and RSpec setup.
Naming -test- sorry I meant specs
Now, again, I am fully aware that this book is neither about testing or RSpec, however, I feel that it is benificial for your readers to get the first impression accordingly to established best practtices.
But the biggest problem your tests are having is the access to the development database, which implies two major inconveniences:
Tests will interfere with the application.
Tools like Database Cleaner (https://github.com/bmabey/database_cleaner) cannot be used anymore.
And validations for uniquness at latest will make the usage of such tools completely necessary.
I suggest to adapt the code to this environment awareness and introduce the standard RSpec layout and naming conventions. This does not necessarily need to bloat the text of the book, I guess external links or even additions to the TODOs might be able to cover this issue.
After talking so much I have taken the time to create two gists with tested code that would be a solid setup for a
DataMapper using Sinatra project.
Here are the refs: