Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- describe 'MoviePopup', ->
- describe 'setup', ->
- it 'adds popup Div to main page', ->
- expect $('#movieInfo').toExist()
- it 'hides the popup Div', ->
- expect $('#movieInfo').toBeHidden()
- describe 'AJAX call to server', ->
- beforeEach -> loadFixtures('movie_row.html')
- it 'calls correct URL', ->
- spyOn $, 'ajax'
- $('#movies a').trigger 'click'
- expect($.ajax.mostRecentCall.args[0]['url']).toEqual '/movies/1'
- describe 'when successful', ->
- beforeEach ->
- @htmlResponse = readFixtures 'movie_info.html'
- spyOn($, 'ajax').andCallFake ->(ajaxArgs)
- ajaxArgs.success(htmlResponse, '200')
- $('#movies a').trigger 'click'
- it 'makes #movieInfo visible', ->
- expect $('#movieInfo').toBeVisible()
- it 'places movie title in #movieInfo', ->
- expect($('#movieInfo').text()).toContain 'Casablanca'
Add Comment
Please, Sign In to add comment