Hi,
I am getting an error I cannot figure out on my test.
I have what I think is the exact code from the book, other than I changed “use” to “import” to fix a deprecation warning:
defmodule Sneakers23Web.ProductChannelTest do
#use Sneakers23Web.ChannelCase, async: true
import Sneakers23Web.ChannelCase
alias Sneakers23Web.{Endpoint, ProductChannel}
alias Sneakers23.Inventory.CompleteProduct
describe "notify product released" do
test "the size selector for the product is broadcast" do
{inventory, _data} = Test.Factory.InventoryFactory.complete_products()
[_, product] = CompleteProduct.get_complete_products(inventory)
topic = "product:#{id}"
Endpoint.subscribe(topic)
ProductChannel.notify_product_released(product)
assert_broadcast "released", %{size_html: html}
assert html =~ "size-container__entry"
Enum.each(product.items, fn item ->
assert html =~ ~s(value="#{item.id}")
end)
end
end
end
The error I get is:
sneakers_23 % mix test
12:57:13.705 [info] Migrations already up
…
== Compilation error in file test/sneakers_23_web/product_channel_test.exs ==
** (CompileError) test/sneakers_23_web/product_channel_test.exs:8: undefined function describe/2
(stdlib 3.15.2) erl_eval.erl:685: :erl_eval.do_apply/6
(elixir 1.12.1) lib/kernel/parallel_compiler.ex:428: Kernel.ParallelCompiler.require_file/2
(elixir 1.12.1) lib/kernel/parallel_compiler.ex:321: anonymous fn/4 in Kernel.ParallelCompiler.spawn_workers/7
I can imagine why describe would not show up if I am not importing the right test module, but why is it saying I have describe/2 when I am clearly only giving it one argument? Changing import back to use doesn’t fix anything either.