From 8ffd16366f936e734498d370b96063cf99e947c0 Mon Sep 17 00:00:00 2001 From: Valera Rozuvan Date: Thu, 5 Sep 2013 14:29:26 +0300 Subject: [PATCH] Fix for test. Must clear the state youtubeXhr variable before counting number of ajax calls. --- .../xmodule/xmodule/js/spec/video/general_spec.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/common/lib/xmodule/xmodule/js/spec/video/general_spec.js b/common/lib/xmodule/xmodule/js/spec/video/general_spec.js index c1548fd2be..3daa8cb4bd 100644 --- a/common/lib/xmodule/xmodule/js/spec/video/general_spec.js +++ b/common/lib/xmodule/xmodule/js/spec/video/general_spec.js @@ -188,15 +188,20 @@ describe('multiple YT on page', function () { beforeEach(function () { - $.ajax.calls.length = 0; - $.ajaxWithPrefix.calls = 0; - loadFixtures('video_yt_multiple.html'); - state1 = new Video('#example1'); - spyOn($, 'ajaxWithPrefix'); + $.ajax.calls.length = 0; + $.ajaxWithPrefix.calls.length = 0; + + // Because several other tests have run, the variable + // that stores the value of the first ajax request must be + // cleared so that we test a pristine state of the video + // module. + Video.clearYoutubeXhr(); + + state1 = new Video('#example1'); state2 = new Video('#example2'); state3 = new Video('#example3'); });