tests for https://github.com/couchbase/sync_gateway/issues/158