Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add :enabled option to config #138

Closed
lstrzebinczyk opened this issue Jun 17, 2020 · 1 comment
Closed

Add :enabled option to config #138

lstrzebinczyk opened this issue Jun 17, 2020 · 1 comment

Comments

@lstrzebinczyk
Copy link

lstrzebinczyk commented Jun 17, 2020

Hi. Thank you for working on this!

I have a module like this in my code:

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?

@danielberkompas
Copy link
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants