From 8f6ca700553bdb88fa924dba21f5cb00a3c515f1 Mon Sep 17 00:00:00 2001
From: Jacob Schatz <jacobschatz@Jacobs-MBP.fios-router.home>
Date: Thu, 7 Jan 2016 12:27:01 -0500
Subject: [PATCH] fixes ajax issue with issue spec

---
 Gemfile.lock                          | 12 +++++-----
 spec/javascripts/issue_spec.js.coffee | 32 +++++++++++++--------------
 2 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/Gemfile.lock b/Gemfile.lock
index a1168ed3b7a57..f5391ef9e4853 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -443,6 +443,10 @@ GEM
     omniauth (1.2.2)
       hashie (>= 1.2, < 4)
       rack (~> 1.0)
+    omniauth-azure-oauth2 (0.0.6)
+      jwt (~> 1.0)
+      omniauth (~> 1.0)
+      omniauth-oauth2 (~> 1.1)
     omniauth-bitbucket (0.0.2)
       multi_json (~> 1.7)
       omniauth (~> 1.1)
@@ -488,10 +492,6 @@ GEM
       activesupport
       nokogiri (>= 1.4.4)
       omniauth (~> 1.0)
-    omniauth-azure-oauth2 (0.0.6)
-      jwt (~> 1.0)
-      omniauth (~> 1.0)
-      omniauth-oauth2 (~> 1.1)
     opennebula (4.14.2)
       json
       nokogiri
@@ -920,6 +920,7 @@ DEPENDENCIES
   oauth2 (~> 1.0.0)
   octokit (~> 3.7.0)
   omniauth (~> 1.2.2)
+  omniauth-azure-oauth2
   omniauth-bitbucket (~> 0.0.2)
   omniauth-cas3 (~> 1.1.2)
   omniauth-facebook (~> 3.0.0)
@@ -931,7 +932,6 @@ DEPENDENCIES
   omniauth-shibboleth (~> 1.2.0)
   omniauth-twitter (~> 1.2.0)
   omniauth_crowd
-  omniauth-azure-oauth2
   org-ruby (~> 0.9.12)
   paranoia (~> 2.0)
   pg (~> 0.18.2)
@@ -999,4 +999,4 @@ DEPENDENCIES
   wikicloth (= 0.8.1)
 
 BUNDLED WITH
-   1.10.6
+   1.11.2
diff --git a/spec/javascripts/issue_spec.js.coffee b/spec/javascripts/issue_spec.js.coffee
index 7e67c77886109..b85fadcbe82e0 100644
--- a/spec/javascripts/issue_spec.js.coffee
+++ b/spec/javascripts/issue_spec.js.coffee
@@ -26,10 +26,10 @@ describe 'reopen/close issue', ->
     fixture.load('issues_show.html')
     @issue = new Issue()
   it 'closes an issue', ->
-    $.ajax = (obj) ->
-      expect(obj.type).toBe('PUT')
-      expect(obj.url).toBe('http://gitlab.com/issues/6/close')
-      obj.success saved: true
+    spyOn(jQuery, 'ajax').and.callFake (req) ->
+      expect(req.type).toBe('PUT')
+      expect(req.url).toBe('http://gitlab.com/issues/6/close')
+      req.success saved: true
     
     $btnClose = $('a.btn-close')
     $btnReopen = $('a.btn-reopen')
@@ -46,10 +46,10 @@ describe 'reopen/close issue', ->
 
   it 'fails to closes an issue with success:false', ->
 
-    $.ajax = (obj) ->
-      expect(obj.type).toBe('PUT')
-      expect(obj.url).toBe('http://goesnowhere.nothing/whereami')
-      obj.success saved: false
+    spyOn(jQuery, 'ajax').and.callFake (req) ->
+      expect(req.type).toBe('PUT')
+      expect(req.url).toBe('http://goesnowhere.nothing/whereami')
+      req.success saved: false
     
     $btnClose = $('a.btn-close')
     $btnReopen = $('a.btn-reopen')
@@ -69,10 +69,10 @@ describe 'reopen/close issue', ->
 
   it 'fails to closes an issue with HTTP error', ->
 
-    $.ajax = (obj) ->
-      expect(obj.type).toBe('PUT')
-      expect(obj.url).toBe('http://goesnowhere.nothing/whereami')
-      obj.error()
+    spyOn(jQuery, 'ajax').and.callFake (req) ->
+      expect(req.type).toBe('PUT')
+      expect(req.url).toBe('http://goesnowhere.nothing/whereami')
+      req.error()
     
     $btnClose = $('a.btn-close')
     $btnReopen = $('a.btn-reopen')
@@ -91,10 +91,10 @@ describe 'reopen/close issue', ->
     expect($('div.flash-alert').text()).toBe('Unable to update this issue at this time.')
 
   it 'reopens an issue', ->
-    $.ajax = (obj) ->
-      expect(obj.type).toBe('PUT')
-      expect(obj.url).toBe('http://gitlab.com/issues/6/reopen')
-      obj.success saved: true
+    spyOn(jQuery, 'ajax').and.callFake (req) ->
+      expect(req.type).toBe('PUT')
+      expect(req.url).toBe('http://gitlab.com/issues/6/reopen')
+      req.success saved: true
 
     $btnClose = $('a.btn-close')
     $btnReopen = $('a.btn-reopen')
-- 
GitLab