saasbook

coffee_example_spec.coffee

Mar 13th, 2014
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. describe 'MoviePopup', ->
  2. describe 'setup', ->
  3. it 'adds popup Div to main page', ->
  4. expect $('#movieInfo').toExist()
  5. it 'hides the popup Div', ->
  6. expect $('#movieInfo').toBeHidden()
  7. describe 'AJAX call to server', ->
  8. beforeEach -> loadFixtures('movie_row.html')
  9. it 'calls correct URL', ->
  10. spyOn $, 'ajax'
  11. $('#movies a').trigger 'click'
  12. expect($.ajax.mostRecentCall.args[0]['url']).toEqual '/movies/1'
  13. describe 'when successful', ->
  14. beforeEach ->
  15. @htmlResponse = readFixtures 'movie_info.html'
  16. spyOn($, 'ajax').andCallFake ->(ajaxArgs)
  17. ajaxArgs.success(htmlResponse, '200')
  18. $('#movies a').trigger 'click'
  19. it 'makes #movieInfo visible', ->
  20. expect $('#movieInfo').toBeVisible()
  21. it 'places movie title in #movieInfo', ->
  22. expect($('#movieInfo').text()).toContain 'Casablanca'
Add Comment
Please, Sign In to add comment