Again it seems like you're not testing much here. What is user_invite() supposed to do if the user already exists? Return the existing user? Maybe test that explicitly. Also is the `rand` line here actually being used?