summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorRobert Speicher <rspeicher@gmail.com>2015-05-06 17:02:14 -0400
committerRobert Speicher <rspeicher@gmail.com>2015-05-28 18:22:32 -0400
commitd2256c18f4c4a5f896460be69b05df75303b107f (patch)
treedb64d6c3aac64fc390daa3a3c9b4a72dcb977325 /spec
parentc9788bd9d8f6e7b7ae445b61b06877411ee01c9e (diff)
downloadgitlab-ce-d2256c18f4c4a5f896460be69b05df75303b107f.tar.gz
Stub ajax in JS specs
Diffstat (limited to 'spec')
-rw-r--r--spec/javascripts/issue_spec.js.coffee3
-rw-r--r--spec/javascripts/merge_request_spec.js.coffee4
2 files changed, 5 insertions, 2 deletions
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)