From b908aed35ef4191bc4583fb29f1c5fa5b8c56fab Mon Sep 17 00:00:00 2001 From: Randy Coulman Date: Sat, 27 Nov 2021 22:17:59 -0800 Subject: [PATCH] Attempt to fix compilation errors From my reading of the docs and other research, it looks like `Code.ensure_loaded?` is a better way to check whether an optional dependency module exists or not. --- lib/assertions/absinthe.ex | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/assertions/absinthe.ex b/lib/assertions/absinthe.ex index 3e18bc1..cd11e9d 100644 --- a/lib/assertions/absinthe.ex +++ b/lib/assertions/absinthe.ex @@ -19,7 +19,7 @@ defmodule Assertions.Absinthe do and then all functions in this module will not need the schema passed explicitly into it. """ - if match?({:module, _}, Code.ensure_compiled(Absinthe)) do + if Code.ensure_loaded?(Absinthe) do require Assertions require ExUnit.Assertions @@ -104,8 +104,8 @@ defmodule Assertions.Absinthe do iex> query = "{ user { #{document_for(:user, 2)} } }" iex> assert_response_matches(query) do - %{"user" => %{"name" => "B" <> _, "posts" => posts}} - end + ...> %{"user" => %{"name" => "B" <> _, "posts" => posts}} + ...> end iex> assert length(posts) == 1 """ @spec assert_response_matches(module(), String.t(), Keyword.t(), Macro.expr()) ::