From f6c3b357451a2125550811946084fc25ae4eb0ce Mon Sep 17 00:00:00 2001 From: Georgios Kalpakas Date: Thu, 23 Jun 2016 23:16:06 +0300 Subject: [PATCH] test($resource): make test for function as param more explicit Related to aa8d783. Closes #14820 --- src/ngResource/resource.js | 4 ++-- test/ngResource/resourceSpec.js | 9 ++++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/ngResource/resource.js b/src/ngResource/resource.js index bdbfb778f771..bd1bea78cef9 100644 --- a/src/ngResource/resource.js +++ b/src/ngResource/resource.js @@ -116,7 +116,7 @@ function shallowClearAndCopy(src, dst) { * @param {Object=} paramDefaults Default values for `url` parameters. These can be overridden in * `actions` methods. If a parameter value is a function, it will be called every time * a param value needs to be obtained for a request (unless the param was overridden). The function - * will be passed the current data value as a argument. + * will be passed the current data value as an argument. * * Each key value in the parameter object is first bound to url template if present and then any * excess keys are appended to the url search query after the `?`. @@ -149,7 +149,7 @@ function shallowClearAndCopy(src, dst) { * - **`params`** – {Object=} – Optional set of pre-bound parameters for this action. If any of * the parameter value is a function, it will be called every time when a param value needs to * be obtained for a request (unless the param was overridden). The function will be passed the - * current data value as a argument. + * current data value as an argument. * - **`url`** – {string} – action specific `url` override. The url templating is supported just * like for the resource-level urls. * - **`isArray`** – {boolean=} – If true then the returned object for this action is an array, diff --git a/test/ngResource/resourceSpec.js b/test/ngResource/resourceSpec.js index c28ecf097861..1c10bebee701 100644 --- a/test/ngResource/resourceSpec.js +++ b/test/ngResource/resourceSpec.js @@ -667,11 +667,14 @@ describe("basic usage", function() { expect(fedor).toEqualData({id: 'fedor', email: 'f@f.com', count: 1}); - $httpBackend.expect('POST', '/Person/fedor').respond( - {id: 'fedor', email: 'f@f.com', count: 2}); + $httpBackend.expect('POST', '/Person/fedor2').respond( + {id: 'fedor2', email: 'f2@f.com', count: 2}); + + fedor.id = 'fedor2'; fedor.$save(); $httpBackend.flush(); - expect(fedor).toEqualData({id: 'fedor', email: 'f@f.com', count: 2}); + + expect(fedor).toEqualData({id: 'fedor2', email: 'f2@f.com', count: 2}); });