Skip to content

Commit

Permalink
Merge pull request #473 from bschmeck/document-mock-error
Browse files Browse the repository at this point in the history
Document that Tesla.Mock can be configured to return error tuples
  • Loading branch information
teamon committed Jul 26, 2021
2 parents 3549695 + 3ce4a93 commit c723762
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/tesla/mock.ex
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@ defmodule Tesla.Mock do
Tesla.Mock.mock(fn
%{method: :post} -> {201, %{}, %{id: 42}}
end)
# mock will also accept error tuples in the form
# of {:error, reason}
Tesla.Mock.mock(fn
%{method: :post} -> {:error, :timeout}
end)
```
## Global mocks
Expand Down

0 comments on commit c723762

Please sign in to comment.