alters database cleaning for rspec to avoid race conditions

Tries to implement a different way for cleaning the DB when running rspec tests.

This is taken 100% from [stackoverflow](http://stackoverflow.com/questions/21922046/deadlock-detected-with-capybara-webkit).

Without the changes, the capybara powered specs fail often on my machine due to race conditions where the thread running the tests was trying to access data the thread running the backend had not yet created. After the fix, that never happened to me. Additionally,  the specs run faster on my machine (subjective).

Please try whether this also works on your machine(s).