Guest User

Untitled

a guest
Oct 9th, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. describe 'Task', ->
  2.  
  3. #(...)
  4.  
  5. describe "getters", ->
  6.  
  7. describe "getId", ->
  8.  
  9. it "should be defined", ->
  10. expect(@task.getId).toBeDefined()
  11. it "should return model's id", ->
  12. stub = sinon.stub(@task, 'get').returns 1
  13.  
  14. expect(@task.getId()).toEqual 1
  15. expect(stub.calledWith('id')).toBeTruthy()
  16.  
  17. describe "getName", ->
  18.  
  19. it "should be defined", ->
  20. expect(@task.getName).toBeDefined()
  21.  
  22. it "should return its name", ->
  23. spyOn(@task, 'get').andReturn 'Trololo!'
  24.  
  25. expect(@task.getName()).toEqual 'Trololo!'
  26. expect(@task.get).toHaveBeenCalledWith('name')
  27.  
  28. describe "isCompleted", ->
  29.  
  30. it "should be defined", ->
  31. expect(@task.isCompleted).toBeDefined()
  32. it "should return value for the completed attribute", ->
  33. spyOn(@task, 'get').andReturn(false)
  34.  
  35. expect(@task.isCompleted()).toEqual false
  36. expect(@task.get).toHaveBeenCalledWith('completed')
  37.  
  38. describe "getEstimation", ->
  39.  
  40. it "should be defined", ->
  41. expect(@task.getEstimation).toBeDefined()
  42. it "should return its estimation", ->
  43. spyOn(@task, 'get').andReturn 5
  44.  
  45. expect(@task.getEstimation()).toEqual 5
  46. expect(@task.get).toHaveBeenCalledWith("estimation")
Add Comment
Please, Sign In to add comment