Fixes failing testing ResourceFactoryProviderSpec

This commit is contained in:
SWatro 2013-12-26 14:13:39 -06:00
parent e6c10b2513
commit 73f835199e

View File

@ -1,17 +1,20 @@
describe("ResourceFactoryProvider", function() {
var ngResource,
rootScope,
apiVersion = "/mifosng-provider/api/v1";
beforeEach(function() {
this.provider = new mifosX.services.ResourceFactoryProvider();
ngResource = jasmine.createSpy("$resource").andReturn("test_resource");
rootScope = jasmine.createSpyObj("$rootScope",["hostUrl"]);
this.factory = this.provider.$get[1](ngResource);
this.factory = this.provider.$get[2](ngResource,rootScope);
});
describe("User resource", function() {
it("should define the User resource", function() {
expect(ngResource).toHaveBeenCalledWith(apiVersion + "/users/:userId", {}, {
getAllUsers: {method: 'GET', params: {fields: "id,firstname,lastname,username,officeName"}, isArray: true}
expect(ngResource).toHaveBeenCalledWith(apiVersion + "/users/:userId", {userId:'@userId'}, {
getAllUsers: {method: 'GET', params: {fields: "id,firstname,lastname,username,officeName"}, isArray: true},
getUser: {method:'GET',params:{}}
});
expect(this.factory.userResource).toEqual("test_resource");
});