Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- override def beforeAll = {
- user = new User
- user.username = "arni"
- user.email = "arnir06@ru.is"
- user.password = Sha1HashService.hash("test")
- user.role = Role.Chair
- user = userRepository.save(user)
- }
- describe("user service") {
- describe("should authenticate when") {
- it("username exists and password matches") {
- userService.authenticate("arni", "test") should be('defined)
- }
- it("email exists and password matches") {
- userService.authenticate("arnir06@ru.is", "test") should be('defined)
- }
- }
- describe("should not authenticate when") {
- it("username exists and password doesn't match") {
- userService.authenticate("arni", "toast") should be('empty)
- }
- it("email exists and password doesn't match") {
- userService.authenticate("arnir06@ru.is", "toast") should be('empty)
- }
- it("username doesn't exists and password matches") {
- userService.authenticate("steinar", "test") should be('empty)
- }
- it("username doesn't exist and password doesn't match") {
- userService.authenticate("steinar", "toast") should be('empty)
- }
- }
- }
- override def afterAll = {
- userRepository.delete(user)
- }
Add Comment
Please, Sign In to add comment