Hi, I’m trying to test my config settings. To do that, i use a module that load them: like this
defmodule App.SettingsBehaviour do @moduledoc """ Define the behavior for accessing environment variable settings """ @callback is_search_enabled :: boolean end defmodule App.BoundSettings do @options Application.get_env(:app, :options, App.Settings) def is_search_enabled do @options.is_search_enabled end end defmodule App.Settings do @behaviour App.SettingsBehaviour @impl App.SettingsBehaviour def is_search_enabled, do: Application.get_env(:app, :search_enabled, false) end
I have a liveview controller calling App.Settings, and when i try to mock it it returns UnexpectedCallError. Does anyone understand what could fail here?
it seems that you have 2 implementations of the module App.Settings, one doesn’t define the behaviour App.SettingsBehaviour. one might be overwriting the other.