Skip to content

Can't seem to properly import Absinthe assertions #22

Description

@itsdanferrellnow

Hey, love the work thank you.

But I'm struggling here with consistently getting the assertions methods to properly compile here.

I have a really (really) small phoenix app i whipped up, where I try to add the Assertions.AbsintheCase to the DataCase, and

I try to write a really simple case here

defmodule AssertionsTestWeb.Schema.Queries.UserTest do
  use AssertionsTest.DataCase

  test "resolves correctly" do
    """
    query {
      user {
        #{document_for(:user)}
      }
    }
    """
    |> assert_response_matches do
      %{
        "user" => %{
          "id" => _id
        }
      }
    end
  end
end

and the DataCase.ex looks like

defmodule AssertionsTest.DataCase do
  use ExUnit.CaseTemplate
  using do
    quote do
      alias AssertionsTest.Repo

      import Ecto
      import Ecto.Changeset
      import Ecto.Query
      import AssertionsTest.DataCase

      use Assertions.AbsintheCase, async: true, schema: AssertionsTestWeb.Schema
    end
  end
  # [....]
end

And it can't find assert_response_matches/4.

== Compilation error in file test/assertions_test_web/gql/queries/user_test.exs ==
** (CompileError) test/assertions_test_web/gql/queries/user_test.exs:2: undefined function assert_response_equals/4
    (elixir 1.11.3) src/elixir_locals.erl:114: anonymous fn/3 in :elixir_locals.ensure_no_undefined_local/3
    (stdlib 3.14) erl_eval.erl:680: :erl_eval.do_apply/6
    (elixir 1.11.3) lib/kernel/parallel_compiler.ex:416: Kernel.ParallelCompiler.require_file/2
    (elixir 1.11.3) lib/kernel/parallel_compiler.ex:316: anonymous fn/4 in Kernel.ParallelCompiler.spawn_workers/7

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions