Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a test for nested resources from a addRestangularMethod result #902

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

leahciMic
Copy link

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.

leahciMic pushed a commit to leahciMic/restangular that referenced this pull request Oct 10, 2014
@leahciMic leahciMic force-pushed the should-have-the-correct-url-when-using-addRestangularMethod branch 2 times, most recently from be68a75 to 1a8fbe0 Compare October 15, 2014 03:50
leahciMic added a commit to leahciMic/restangular that referenced this pull request Oct 15, 2014
@daviesgeek
Copy link
Collaborator

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?

leahciMic and others added 2 commits June 21, 2016 16:05
This test identifies an issue I am currently having with `addRestangularMethod`.

Given the following code.

```js
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`.
@leahciMic leahciMic force-pushed the should-have-the-correct-url-when-using-addRestangularMethod branch from ecf4bc0 to f73fcfb Compare June 21, 2016 06:06
@leahciMic
Copy link
Author

@daviesgeek it's definitely been a while since I've used this project. I have rebased the commits for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants