defmodule TextMessage do
def send(phone_number, body) do
case Application.get_env(:our_app, :env) do
:test ->
nil
_ ->
ExTwilio.Message.create(%{
body: body,
to: phone_number,
from: our_phone_number
})
end
end
end
Many libraries have :enabled option, so that I could set it to false in test environment, and just use the code without this additional setup. Would it be possible to add here as well?
I think this would be an excellent place to make use of mocking in your code. Check out this library from the Elixir creators: https://github.com/dashbitco/mox
Hi. Thank you for working on this!
I have a module like this in my code:
Many libraries have :enabled option, so that I could set it to
false
in test environment, and just use the code without this additional setup. Would it be possible to add here as well?