API de comptabilité horaire.
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

user_test.rb 861B

12345678910111213141516171819202122232425
  1. require "test_helper"
  2. class UserTest < ActiveSupport::TestCase
  3. test 'user with a valid email should be valid' do
  4. user = User.new(email: "test@test.com", username: "UserTest", password_digest: 'password')
  5. assert user.valid?
  6. end
  7. test 'user with taken username should be invalid' do
  8. other_user = users(:one)
  9. user = User.new(email: "test@email.com", username: other_user.username, password_digest: "test_password")
  10. assert_not user.valid?
  11. end
  12. test 'user with invalid email should be invalid' do
  13. user = User.new(email: "test_invalid_email", username: "UserTest", password_digest: "test_password")
  14. assert_not user.valid?
  15. end
  16. test 'user with taken email should be invalid' do
  17. other_user = users(:one)
  18. user = User.new(email: other_user.email, username: "UserTest", password_digest: "test_password")
  19. assert_not user.valid?
  20. end
  21. end