Advertisement
saasbook

coffee_example_spec.coffee

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