helun/Ektorp — pull request #208 by YannRobert (2014-09-29 16:59:03+00:00)
Title: should check that the database does not exist before attempting to create it

changed back unit tests to previous behavior + fixed code accordingly

Since #186 the code of createDatabaseIfNotExists() does not longer check if the database exists but just attempt to create it and check for the return code of the DB.
This is changing an existing behavior and could break at existing users of Ektorp and Cloudant Big Couch.
Cloudant forbidds the usage of the CouchDB API to create a new database. Applications should have their Databases already created. Applications using createDatabaseIfNotExists() should then not attempt to create the database, but should find that the database already exists and just proceed.
When the same application runs on a CouchDB service where the database does not exist, then it should find the database does not exists and create it.

Ektorp should keep on checking if the DB already exists before attempting to create it.
However, the code introduced in #186 to ignore the 412 error code if the DB already was created concurrently stays accurate.