Guest User

Untitled

a guest
Mar 4th, 2018
336
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 0 0
  1. override def beforeAll = {
  2. user = new User
  3. user.username = "arni"
  4. user.email = "arnir06@ru.is"
  5. user.password = Sha1HashService.hash("test")
  6. user.role = Role.Chair
  7. user = userRepository.save(user)
  8. }
  9.  
  10. describe("user service") {
  11. describe("should authenticate when") {
  12. it("username exists and password matches") {
  13. userService.authenticate("arni", "test") should be('defined)
  14. }
  15.  
  16. it("email exists and password matches") {
  17. userService.authenticate("arnir06@ru.is", "test") should be('defined)
  18. }
  19. }
  20.  
  21. describe("should not authenticate when") {
  22. it("username exists and password doesn't match") {
  23. userService.authenticate("arni", "toast") should be('empty)
  24. }
  25.  
  26. it("email exists and password doesn't match") {
  27. userService.authenticate("arnir06@ru.is", "toast") should be('empty)
  28. }
  29.  
  30. it("username doesn't exists and password matches") {
  31. userService.authenticate("steinar", "test") should be('empty)
  32. }
  33.  
  34. it("username doesn't exist and password doesn't match") {
  35. userService.authenticate("steinar", "toast") should be('empty)
  36. }
  37. }
  38. }
  39.  
  40. override def afterAll = {
  41. userRepository.delete(user)
  42. }
Add Comment
Please, Sign In to add comment