Adds support for invoking the `on_error` handler. #275

Closed
wants to merge 3 commits into
from

Conversation

Projects
None yet
3 participants
@hsume2

hsume2 commented Apr 8, 2013

Hi,

When writing tests for an EventMachine client, I wanted to ensure that on_error handlers were properly triggered.

This PR adds support for to_errback:

stub_request(:get, "www.example.com").to_errback

Which will then invoke the on_error handler.

@grosser

This comment has been minimized.

Show comment Hide comment
@grosser

grosser Mar 29, 2013

Did you ever make a pull request for this ?

Did you ever make a pull request for this ?

This comment has been minimized.

Show comment Hide comment
@hsume2

hsume2 Apr 8, 2013

Owner

@grosser I did not.

Owner

hsume2 replied Apr 8, 2013

@grosser I did not.

This comment has been minimized.

Show comment Hide comment
@grosser

grosser Apr 8, 2013

Any plan to do it / is it no useful for normal webmock users ?

Any plan to do it / is it no useful for normal webmock users ?

This comment has been minimized.

Show comment Hide comment
@hsume2

hsume2 Apr 8, 2013

Owner

@grosser I think it will be useful. I just opened a PR here bblimke#275

Owner

hsume2 replied Apr 8, 2013

@grosser I think it will be useful. I just opened a PR here bblimke#275

@grosser

This comment has been minimized.

Show comment Hide comment
@grosser

grosser Apr 8, 2013

Contributor

👍

Contributor

grosser commented Apr 8, 2013

👍

@bblimke

This comment has been minimized.

Show comment Hide comment
@bblimke

bblimke Apr 8, 2013

Owner

Thank you for this pull request and suggesting this feature.
WebMock purpose is to provide http client independent mocking API. This change adds EM only method to WebMock generic API, which unfortunately makes it useless for all other http clients except EM.
WebMock API has to_raise method. Maybe it's possible to implement to_raise behaviour in EM adapter instead?

Owner

bblimke commented Apr 8, 2013

Thank you for this pull request and suggesting this feature.
WebMock purpose is to provide http client independent mocking API. This change adds EM only method to WebMock generic API, which unfortunately makes it useless for all other http clients except EM.
WebMock API has to_raise method. Maybe it's possible to implement to_raise behaviour in EM adapter instead?

@hsume2

This comment has been minimized.

Show comment Hide comment
@hsume2

hsume2 Apr 9, 2013

@bblimke thanks for the suggestion, that makes sense. I'll give that a shot and see if I can get anywhere with that :)

hsume2 commented Apr 9, 2013

@bblimke thanks for the suggestion, that makes sense. I'll give that a shot and see if I can get anywhere with that :)

@bblimke

This comment has been minimized.

Show comment Hide comment
@bblimke

bblimke Jun 4, 2013

Owner

to_errback is only em-http-request specific so this pull request can't be merged in this form.

Owner

bblimke commented Jun 4, 2013

to_errback is only em-http-request specific so this pull request can't be merged in this form.

@bblimke bblimke closed this Jun 4, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment