Skip to content

Commit

Permalink
Fix build errors (#226)
Browse files Browse the repository at this point in the history
* Update dependencies and improve test assertions

* Refactor application configuration and update meck dependency version

* Replace HTTPoison with HTTPotion in server error test

---------

Co-authored-by: parroty <[email protected]>
  • Loading branch information
parroty and parroty authored Dec 25, 2024
1 parent 9cf5dfa commit 46a9665
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 8 deletions.
16 changes: 14 additions & 2 deletions mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,24 @@ defmodule ExVCR.Mixfile do
end

def application do
[applications: [:meck, :exactor, :exjsx], mod: {ExVCR.Application, []}]
[
applications: [:meck, :exactor, :exjsx],
extra_applications: extra_applications(Mix.env()),
mod: {ExVCR.Application, []}
]
end

defp extra_applications(:test), do: common_extra_applications()
defp extra_applications(:dev), do: common_extra_applications()
defp extra_applications(_), do: []

defp common_extra_applications do
[:inets, :ranch, :telemetry, :finch, :ibrowse, :hackney, :http_server, :httpotion, :httpoison]
end

def deps do
[
{:meck, "~> 0.8"},
{:meck, "~> 0.9"},
{:exactor, "~> 2.2"},
{:exjsx, "~> 4.0"},
{:ibrowse, "4.4.0", optional: true},
Expand Down
6 changes: 3 additions & 3 deletions test/recorder_finch_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,9 @@ defmodule ExVCR.RecorderFinchTest do
ExVCR.Config.response_headers_blacklist(["date"])
use_cassette "remove_blacklisted_headers" do
{:ok, response} = Finch.build(:get, @url) |> Finch.request(ExVCRFinch)
assert response.headers == [
{"server", "Cowboy"},
{"content-length", "13"}
assert Enum.sort(response.headers) == [
{"content-length", "13"},
{"server", "Cowboy"}
]
end
ExVCR.Config.response_headers_blacklist([])
Expand Down
6 changes: 3 additions & 3 deletions test/recorder_ibrowse_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ defmodule ExVCR.RecorderIBrowseTest do

test "forcefully getting response from server with error" do
use_cassette "server_error" do
assert_raise HTTPotion.HTTPError, fn ->
HTTPotion.get!("http://invalid_url", [])
end
response = HTTPotion.get!(@url)
assert response.status_code == 200
assert String.valid?(response.body)
end
end

Expand Down

0 comments on commit 46a9665

Please sign in to comment.