ngw

ngw

Warning function is undefined

Hello, I have a strange warning when running my tests:

warning: function Parker.Test.FakeHTTPipe.get/2 is undefined (module Parker.Test.FakeHTTPipe is not available)
lib/parker/adapters/httpipe.ex:6

I’ve build a “fake” http library that should be used in my tests in substitution to HTTPipe.
This library is located under test/support and is loaded just before running the tests in test_helper.exs

Path.join([File.cwd!, "test", "support", "*"])
|> Path.wildcard
|> Enum.map(fn(file) -> Code.load_file(file) end)

and called by the app using config/test.exs and a variable that points to the configuration (pretty much the same as in Mocks and explicit contracts « Plataformatec Blog)
Am I supposed to Code.load_file somewhere else to make that warning disappear?

Thanks in advance, ngw

Marked As Solved

hubertlepicki

hubertlepicki

In comments, in article you liked to is a solution. I do not think you need to use Code.load at all. Instead you can add the test/support to the compile path in test Mix.env and it should compile it / include properly.

Check out his example mixfile from Phoenix itself (also linked in the comments):
https://github.com/phoenixframework/phoenix/blob/master/installer/templates/new/mix.exs#L30-L31

Also Liked

ngw

ngw

Ahhh, and what’s funny is that I already had that, but of course it wasn’t working because in test/support I was writing .exs files…
Thanks a lot!

Last Post!

ngw

ngw

Ahhh, and what’s funny is that I already had that, but of course it wasn’t working because in test/support I was writing .exs files…
Thanks a lot!

Where Next?

Popular in Questions Top

minhajuddin
I have seen a lot of code which picks the first element from a list using Enum.at(0) instead of List.first. Is there a reason why people ...
New
vonH
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
New
PeterCarter
There are pre-rolled solutions for other frameworks that do work. However, Phoenix does not seem to have these. Have people had good expe...
New
dokuzbir
I want to highlight html closing tags when i click a html tag. That works in .html files but doesnt work for html.eex templates. How can...
New
albydarned
Hello all! I am typing this post from my new MacBook Pro with the M1 chip. I’m loving it so far, and will probably use it as my daily dr...
New
dblack
I’ve got an issue with an app and I’ve no idea of how to troubleshoot it. I’m hoping someone here might have seen something similar. I p...
New
Harrisonl
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service. Currently when I de...
New

Other popular topics Top

KronicDeth
Elixir plugin for JetBrain’s IntelliJ Platform (including Rubymine) This is a plugin that adds support for Elixir to JetBrains IntelliJ...
289 36689 110
New
electic
Hi, I am new to Elixir. I am trying to use the DateTime component to insert a date into MySQL however the there seems to be no way to fo...
New
JeremM34
Hello, how can I check the Phoenix version ? Thanks !
New
openscript
Hello! Sorry for this astonishing simple question, but I’m really stuck. I try to set up the intellij-elixir plugin, but I don’t know ho...
New
Patoshizzle
After calling mix ecto.create I get this error: 17:00:32.162 [error] GenServer #PID<0.412.0> terminating ** (Postgrex.Error) FATAL...
New
AstonJ
Posting this to see if we can make things easier for people to get into Neovim. If you use Neovim and have a favourite distro please let ...
New

We're in Beta

About us Mission Statement