From d2256c18f4c4a5f896460be69b05df75303b107f Mon Sep 17 00:00:00 2001 From: Robert Speicher Date: Wed, 6 May 2015 17:02:14 -0400 Subject: Stub ajax in JS specs --- spec/javascripts/issue_spec.js.coffee | 3 ++- spec/javascripts/merge_request_spec.js.coffee | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'spec') diff --git a/spec/javascripts/issue_spec.js.coffee b/spec/javascripts/issue_spec.js.coffee index abe0754b65a..268e4c68c31 100644 --- a/spec/javascripts/issue_spec.js.coffee +++ b/spec/javascripts/issue_spec.js.coffee @@ -9,11 +9,12 @@ describe 'Issue', -> @issue = new Issue() it 'modifies the Markdown field', -> + spyOn(jQuery, 'ajax').and.stub() $('input[type=checkbox]').attr('checked', true).trigger('change') expect($('.js-task-list-field').val()).toBe('- [x] Task List Item') it 'submits an ajax request on tasklist:changed', -> - spyOn($, 'ajax').and.callFake (req) -> + spyOn(jQuery, 'ajax').and.callFake (req) -> expect(req.type).toBe('PATCH') expect(req.url).toBe('/foo') expect(req.data.issue.description).not.toBe(null) diff --git a/spec/javascripts/merge_request_spec.js.coffee b/spec/javascripts/merge_request_spec.js.coffee index 8b8f77c56cf..a4735af0343 100644 --- a/spec/javascripts/merge_request_spec.js.coffee +++ b/spec/javascripts/merge_request_spec.js.coffee @@ -11,11 +11,13 @@ describe 'MergeRequest', -> @merge = new MergeRequest({}) it 'modifies the Markdown field', -> + spyOn(jQuery, 'ajax').and.stub() + $('input[type=checkbox]').attr('checked', true).trigger('change') expect($('.js-task-list-field').val()).toBe('- [x] Task List Item') it 'submits an ajax request on tasklist:changed', -> - spyOn($, 'ajax').and.callFake (req) -> + spyOn(jQuery, 'ajax').and.callFake (req) -> expect(req.type).toBe('PATCH') expect(req.url).toBe('/foo') expect(req.data.merge_request.description).not.toBe(null) -- cgit v1.2.1