Guest User

Untitled

a guest
Mar 5th, 2018
282
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. valid_model.should validate(:with_message => "Unacceptable email address.") do
  2. valid :email => "foo@bar.com"
  3. valid :email => "foo+extension@bar.com"
  4. valid :email => "foo-bar@test.com"
  5. valid :email => "foo-bar@test.domain.com"
  6. invalid :email => "anything@domain.we.dont.like"
  7. invalid :email => "no spaces please foo@bar.com"
  8. invalid :email => "@no.username.com"
  9. invalid :email => "only_tld@com"
  10. end
  11.  
  12. valid_model.should validate(:error_message => "local users must use a local username")
  13. valid :email => "username", :type => "local"
  14. valid :email => "username@local.domain", :type => "local"
  15. invalid :email => "username@domain.com", :type => "local"
  16. end
  17.  
  18. valid_model.should validate(:error_message => "Should provide email address") do
  19. invalid :email => ""
  20. valid :email => "", :status => "registration incomplete"
  21. valid :email => "", :user_role => "fake"
  22. valid :email => "", :user_role => "admin"
  23. end
Add Comment
Please, Sign In to add comment