restangular
restangular copied to clipboard
Add a test for nested resources from a `addRestangularMethod` result
This test identifies an issue I am currently having with addRestangularMethod.
Given the following code.
var Accounts = Restangular.withConfig(function(RestangularConfigurer) {
RestangularConfigurer.addElementTransformer('users', true, function(worker) {
worker.addRestangularMethod('doSomething', 'get', 'do-something');
return worker;
});
}).service('accounts');
Accounts.doSomething().then(function(doSomething) {
doSomething.one('foo').get();
});
I would expect doSomething.one('foo').get() to fetch accounts/do-something/foo,
and not accounts/foo.
I think this looks good, but I'll have to read over it and review it in more depth before merging. Can you squash the commits into one or two commits please?
@daviesgeek it's definitely been a while since I've used this project. I have rebased the commits for you.