modified user.rb and tests for User model