refactors user model and adds tests to user spec