diff options
| author | Vojta Jina | 2011-05-31 10:32:54 +0200 | 
|---|---|---|
| committer | Vojta Jina | 2011-05-31 10:32:54 +0200 | 
| commit | 2e5199997c77cb2febed4ff21bc12a5d5fbad4ce (patch) | |
| tree | da57107e2e07e5d160af0383cbd86ee2fbc94c80 | |
| parent | b2f5299e0e3d6e4892b7fcc37686012147bf0afa (diff) | |
| download | angular.js-2e5199997c77cb2febed4ff21bc12a5d5fbad4ce.tar.bz2 | |
Rename deprecated wasCalled() -> toHaveBeenCalled() in all specs
As well as wasNotCalled(), wasCalledWith(), wasNotCalledWith()
| -rw-r--r-- | test/BrowserSpecs.js | 14 | ||||
| -rw-r--r-- | test/JsonSpec.js | 4 | ||||
| -rw-r--r-- | test/ResourceSpec.js | 22 | ||||
| -rw-r--r-- | test/ScopeSpec.js | 2 | ||||
| -rw-r--r-- | test/ValidatorsSpec.js | 6 | ||||
| -rw-r--r-- | test/service/deferSpec.js | 8 | ||||
| -rw-r--r-- | test/service/xhr.bulkSpec.js | 4 | ||||
| -rw-r--r-- | test/service/xhr.cacheSpec.js | 8 | ||||
| -rw-r--r-- | test/service/xhr.errorSpec.js | 2 | ||||
| -rw-r--r-- | test/service/xhrSpec.js | 2 | 
10 files changed, 36 insertions, 36 deletions
| diff --git a/test/BrowserSpecs.js b/test/BrowserSpecs.js index 45e5f6be..635909a7 100644 --- a/test/BrowserSpecs.js +++ b/test/BrowserSpecs.js @@ -59,18 +59,18 @@ describe('browser', function(){      it('should process callbacks immedietly with no outstanding requests', function(){        var callback = jasmine.createSpy('callback');        browser.notifyWhenNoOutstandingRequests(callback); -      expect(callback).wasCalled(); +      expect(callback).toHaveBeenCalled();      });      it('should queue callbacks with outstanding requests', function(){        var callback = jasmine.createSpy('callback');        browser.xhr('GET', '/url', null, noop);        browser.notifyWhenNoOutstandingRequests(callback); -      expect(callback).not.wasCalled(); +      expect(callback).not.toHaveBeenCalled();        xhr.readyState = 4;        xhr.onreadystatechange(); -      expect(callback).wasCalled(); +      expect(callback).toHaveBeenCalled();      });    }); @@ -83,7 +83,7 @@ describe('browser', function(){            log += code + ':' + data + ';';          });          browser.notifyWhenNoOutstandingRequests(callback); -        expect(callback).not.wasCalled(); +        expect(callback).not.toHaveBeenCalled();          expect(scripts.length).toEqual(1);          var script = scripts[0];          script.remove = function(){ @@ -93,7 +93,7 @@ describe('browser', function(){          expect(url[0]).toEqual('http://example.org/path');          expect(typeof fakeWindow[url[1]]).toEqual($function);          fakeWindow[url[1]]('data'); -        expect(callback).wasCalled(); +        expect(callback).toHaveBeenCalled();          expect(log).toEqual('remove();200:data;');          expect(typeof fakeWindow[url[1]]).toEqual('undefined');        }); @@ -172,10 +172,10 @@ describe('browser', function(){      it('should update outstandingRequests counter', function() {        var callback = jasmine.createSpy('callback');        browser.defer(callback); -      expect(callback).not.wasCalled(); +      expect(callback).not.toHaveBeenCalled();        fakeSetTimeout.flush(); -      expect(callback).wasCalled(); +      expect(callback).toHaveBeenCalled();      });    }); diff --git a/test/JsonSpec.js b/test/JsonSpec.js index 4a160905..2067d88f 100644 --- a/test/JsonSpec.js +++ b/test/JsonSpec.js @@ -140,10 +140,10 @@ describe('json', function(){          var spy = this.spyOn(JSON, 'parse').andCallThrough();          expect(fromJson('{}')).toEqual({}); -        expect(spy).wasNotCalled(); +        expect(spy).not.toHaveBeenCalled();          expect(fromJson('{}', true)).toEqual({}); -        expect(spy).wasCalled(); +        expect(spy).toHaveBeenCalled();        }); diff --git a/test/ResourceSpec.js b/test/ResourceSpec.js index fe6c3fdf..127af4ba 100644 --- a/test/ResourceSpec.js +++ b/test/ResourceSpec.js @@ -78,10 +78,10 @@ describe("resource", function() {      var cc = CreditCard.save({name:'misko'}, callback);      nakedExpect(cc).toEqual({name:'misko'}); -    expect(callback).wasNotCalled(); +    expect(callback).not.toHaveBeenCalled();      xhr.flush();      nakedExpect(cc).toEqual({id:123, name:'misko'}); -    expect(callback).wasCalledWith(cc); +    expect(callback).toHaveBeenCalledWith(cc);    });    it("should read resource", function(){ @@ -89,10 +89,10 @@ describe("resource", function() {      var cc = CreditCard.get({id:123}, callback);      expect(cc instanceof CreditCard).toBeTruthy();      nakedExpect(cc).toEqual({}); -    expect(callback).wasNotCalled(); +    expect(callback).not.toHaveBeenCalled();      xhr.flush();      nakedExpect(cc).toEqual({id:123, number:'9876'}); -    expect(callback).wasCalledWith(cc); +    expect(callback).toHaveBeenCalledWith(cc);    });    it("should read partial resource", function(){ @@ -106,7 +106,7 @@ describe("resource", function() {      expect(cc.number).not.toBeDefined();      cc.$get(callback);      xhr.flush(); -    expect(callback).wasCalledWith(cc); +    expect(callback).toHaveBeenCalledWith(cc);      expect(cc.number).toEqual('9876');    }); @@ -115,7 +115,7 @@ describe("resource", function() {      var cc = CreditCard.save({id:{key:123}, name:'misko'}, callback);      nakedExpect(cc).toEqual({id:{key:123}, name:'misko'}); -    expect(callback).wasNotCalled(); +    expect(callback).not.toHaveBeenCalled();      xhr.flush();    }); @@ -124,10 +124,10 @@ describe("resource", function() {      var ccs = CreditCard.query({key:'value'}, callback);      expect(ccs).toEqual([]); -    expect(callback).wasNotCalled(); +    expect(callback).not.toHaveBeenCalled();      xhr.flush();      nakedExpect(ccs).toEqual([{id:1}, {id:2}]); -    expect(callback).wasCalledWith(ccs); +    expect(callback).toHaveBeenCalledWith(ccs);    });    it("should have all arguments optional", function(){ @@ -143,14 +143,14 @@ describe("resource", function() {      xhr.expectDELETE("/CreditCard/123").respond(200, {});      CreditCard.remove({id:123}, callback); -    expect(callback).wasNotCalled(); +    expect(callback).not.toHaveBeenCalled();      xhr.flush();      nakedExpect(callback.mostRecentCall.args).toEqual([{}]);      callback.reset();      xhr.expectDELETE("/CreditCard/333").respond(204, null);      CreditCard.remove({id:333}, callback); -    expect(callback).wasNotCalled(); +    expect(callback).not.toHaveBeenCalled();      xhr.flush();      nakedExpect(callback.mostRecentCall.args).toEqual([{}]);    }); @@ -181,7 +181,7 @@ describe("resource", function() {      nakedExpect(cc).toEqual({name:'misko'});      xhr.flush();      nakedExpect(cc).toEqual({id:123}); -    expect(callback).wasCalledWith(cc); +    expect(callback).toHaveBeenCalledWith(cc);    });    it('should not mutate the resource object if response contains no body', function(){ diff --git a/test/ScopeSpec.js b/test/ScopeSpec.js index ab1ba124..da9c517e 100644 --- a/test/ScopeSpec.js +++ b/test/ScopeSpec.js @@ -62,7 +62,7 @@ describe('scope/model', function(){        var onEval = jasmine.createSpy('onEval');        model.$onEval(onEval);        model.$eval(''); -      expect(onEval).wasNotCalled(); +      expect(onEval).not.toHaveBeenCalled();      });      it('should ignore none string/function', function(){ diff --git a/test/ValidatorsSpec.js b/test/ValidatorsSpec.js index 773ac7d0..4e4592bf 100644 --- a/test/ValidatorsSpec.js +++ b/test/ValidatorsSpec.js @@ -131,10 +131,10 @@ describe('ValidatorTest', function(){        var spy = jasmine.createSpy();        asynchronous.call(self, "kai", spy); -      expect(spy).wasNotCalled(); +      expect(spy).not.toHaveBeenCalled();        asynchronous.call(self, "misko", spy); -      expect(spy).wasCalled(); +      expect(spy).toHaveBeenCalled();      });      it("should ignore old callbacks, and not remove spinner", function(){ @@ -156,7 +156,7 @@ describe('ValidatorTest', function(){        scope.updateFn = jasmine.createSpy();        scope.name = 'misko';        scope.$eval(); -      expect(scope.asyncFn).wasCalledWith('misko', scope.asyncFn.mostRecentCall.args[1]); +      expect(scope.asyncFn).toHaveBeenCalledWith('misko', scope.asyncFn.mostRecentCall.args[1]);        assertTrue(scope.$element.hasClass('ng-input-indicator-wait'));        scope.asyncFn.mostRecentCall.args[1]('myError', {id: 1234, data:'data'});        assertFalse(scope.$element.hasClass('ng-input-indicator-wait')); diff --git a/test/service/deferSpec.js b/test/service/deferSpec.js index 8ac1b803..bd8fe7d7 100644 --- a/test/service/deferSpec.js +++ b/test/service/deferSpec.js @@ -43,10 +43,10 @@ describe('$defer', function() {      var eval = this.spyOn(scope, '$eval').andCallThrough();      $defer(function() {}); -    expect(eval).wasNotCalled(); +    expect(eval).not.toHaveBeenCalled();      $browser.defer.flush(); -    expect(eval).wasCalled(); +    expect(eval).toHaveBeenCalled();      eval.reset(); //reset the spy; @@ -61,10 +61,10 @@ describe('$defer', function() {      var eval = this.spyOn(scope, '$eval').andCallThrough();      $defer(function() {throw "Test Error";}); -    expect(eval).wasNotCalled(); +    expect(eval).not.toHaveBeenCalled();      $browser.defer.flush(); -    expect(eval).wasCalled(); +    expect(eval).toHaveBeenCalled();    });    it('should allow you to specify the delay time', function(){ diff --git a/test/service/xhr.bulkSpec.js b/test/service/xhr.bulkSpec.js index 89429a91..2990e666 100644 --- a/test/service/xhr.bulkSpec.js +++ b/test/service/xhr.bulkSpec.js @@ -57,10 +57,10 @@ describe('$xhr.bulk', function() {      $xhrBulk.flush(function(){ log += 'DONE';});      $browserXhr.flush(); -    expect($xhrError).wasCalled(); +    expect($xhrError).toHaveBeenCalled();      var cb = $xhrError.mostRecentCall.args[0].callback;      expect(typeof cb).toEqual($function); -    expect($xhrError).wasCalledWith( +    expect($xhrError).toHaveBeenCalledWith(          {url:'/req1', method:'GET', data:null, callback:cb},          {status:404, response:'NotFound'}); diff --git a/test/service/xhr.cacheSpec.js b/test/service/xhr.cacheSpec.js index 0a0140a6..ecaebc3f 100644 --- a/test/service/xhr.cacheSpec.js +++ b/test/service/xhr.cacheSpec.js @@ -128,17 +128,17 @@ describe('$xhr.cache', function() {      $browserXhr.expectGET('/url').respond('+');      cache('GET', '/url', null, callback); -    expect(eval).wasNotCalled(); +    expect(eval).not.toHaveBeenCalled();      $browserXhr.flush(); -    expect(eval).wasCalled(); +    expect(eval).toHaveBeenCalled();      eval.reset(); //reset the spy      cache('GET', '/url', null, callback); -    expect(eval).wasNotCalled(); +    expect(eval).not.toHaveBeenCalled();      $browser.defer.flush(); -    expect(eval).wasCalled(); +    expect(eval).toHaveBeenCalled();    });  }); diff --git a/test/service/xhr.errorSpec.js b/test/service/xhr.errorSpec.js index da1b102e..bd9f7a92 100644 --- a/test/service/xhr.errorSpec.js +++ b/test/service/xhr.errorSpec.js @@ -29,7 +29,7 @@ describe('$xhr.error', function() {      $browserXhr.flush();      var cb = $xhrError.mostRecentCall.args[0].callback;      expect(typeof cb).toEqual($function); -    expect($xhrError).wasCalledWith( +    expect($xhrError).toHaveBeenCalledWith(          {url:'/req', method:'POST', data:'MyData', callback:cb},          {status:500, body:'MyError'});    }); diff --git a/test/service/xhrSpec.js b/test/service/xhrSpec.js index 39bc1c66..ebcd90d4 100644 --- a/test/service/xhrSpec.js +++ b/test/service/xhrSpec.js @@ -60,7 +60,7 @@ describe('$xhr', function() {      $xhr('GET', '/reqGET', null, function(){ throw "MyException"; });      $browserXhr.flush(); -    expect($log.error).wasCalledWith("MyException"); +    expect($log.error).toHaveBeenCalledWith("MyException");    }); | 
