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
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
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
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!
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #elixirconf-us
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #security
- #hex









