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

Support for an error response #6

Closed
kiwiupover opened this issue Feb 10, 2015 · 4 comments
Closed

Support for an error response #6

kiwiupover opened this issue Feb 10, 2015 · 4 comments

Comments

@kiwiupover
Copy link
Contributor

Is there a way to handle testing and error response from the server.

Adding an api that could be used in a test that returns an error for an api resource would be helpful.

I see that you are have this as a todo.

it('should have heading', function(done) {
  pretenderify.stub('get', '/contact/:id', 'error');
  visit('/contact/jack');
  andThen(function() {
    assert.equal(find('.container h2').text(), Ember.I18n.t('title'));
    done();
  });
});
@samselikoff
Copy link
Collaborator

yep exactly. Maybe first steps would be to at least expose the server instance so you could use stub as it exists right now - the 4th param is the response code. But I'd also like to think of a nice api, perhaps a global:

it('should have heading', function(done) {
  forceRouteError('get', '/contact/:id', {errors: data}, [optional error code]);
  ...
});

@samselikoff
Copy link
Collaborator

2887721 closes

@samselikoff
Copy link
Collaborator

This is in master, and I'll push out a new release soon. I was thinking of coming up with a new api but the existing route api is good enough, because you'll need to be able to customize the error response.

Check out Acceptance-testing#verb in the wiki for an example.

@kiwiupover
Copy link
Contributor Author

Thanks heaps @samselikoff

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

No branches or pull requests

2 participants