-
Notifications
You must be signed in to change notification settings - Fork 135
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #158 from surik/global-mock
Use global mock in adapters
- Loading branch information
Showing
18 changed files
with
201 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
[ | ||
{ | ||
"request": { | ||
"body": "", | ||
"headers": [], | ||
"method": "get", | ||
"options": { | ||
"with_body": "true" | ||
}, | ||
"request_body": "", | ||
"url": "http://localhost:34009/server" | ||
}, | ||
"response": { | ||
"binary": false, | ||
"body": "test_response", | ||
"headers": { | ||
"server": "Cowboy", | ||
"date": "Tue, 29 Sep 2020 11:50:14 GMT", | ||
"content-length": "13" | ||
}, | ||
"status_code": 200, | ||
"type": "ok" | ||
} | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
[ | ||
{ | ||
"request": { | ||
"body": "", | ||
"headers": [], | ||
"method": "get", | ||
"options": { | ||
"httpc_options": [], | ||
"http_options": [] | ||
}, | ||
"request_body": "", | ||
"url": "http://localhost:34010/server" | ||
}, | ||
"response": { | ||
"binary": false, | ||
"body": "test_response", | ||
"headers": { | ||
"date": "Tue, 29 Sep 2020 11:52:26 GMT", | ||
"server": "Cowboy", | ||
"content-length": "13" | ||
}, | ||
"status_code": [ | ||
"HTTP/1.1", | ||
200, | ||
"OK" | ||
], | ||
"type": "ok" | ||
} | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
[ | ||
{ | ||
"request": { | ||
"body": "", | ||
"headers": [], | ||
"method": "get", | ||
"options": [], | ||
"request_body": "", | ||
"url": "http://localhost:34011/server" | ||
}, | ||
"response": { | ||
"binary": false, | ||
"body": "test_response", | ||
"headers": { | ||
"server": "Cowboy", | ||
"date": "Tue, 29 Sep 2020 11:56:58 GMT", | ||
"content-length": "13" | ||
}, | ||
"status_code": 200, | ||
"type": "ok" | ||
} | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
defmodule ExVCR.Application do | ||
use Application | ||
|
||
def start(_type, _args) do | ||
for app <- [:hackney, :ibrowse, :httpc], true == Code.ensure_loaded?(app) do | ||
app | ||
|> target_methods() | ||
|> Enum.each(fn {function, callback} -> | ||
:meck.expect(app, function, callback) | ||
end) | ||
end | ||
|
||
children = [ExVCR.Actor.CurrentRecorder] | ||
|
||
Supervisor.start_link(children, strategy: :one_for_one, name: ExVCR.Supervisor) | ||
end | ||
|
||
defp target_methods(:hackney), do: ExVCR.Adapter.Hackney.target_methods() | ||
defp target_methods(:ibrowse), do: ExVCR.Adapter.IBrowse.target_methods() | ||
defp target_methods(:httpc), do: ExVCR.Adapter.Httpc.target_methods() | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters