added tests and changed db from sqlite3 to pg and mongoid