Elixir Wizards S4E5 Dave Thomas on Learning How Things Work `Blocked` released! Keep track of when hotfixes can be removed

Create mocks of erlang modules with elixir_mock v0.2.9

Version 0.2.9 of the elixir_mock library now allows you to create mocks from erlang modules like :erlang and :inet.

test "should create simple mocks from erlang modules" do
    mock = mock_of :erlang
    assert mock.self() == nil
end

test "should create custom mocks from erlang modules" do
    with_mock(mock) = defmock_of :inet do
      def ip(_), do: :fake_ip
    end
    assert mock.ip(nil) == :fake_ip
end

ElixirWeekly: The Elixir Community Newsletter, covering community news you easily miss, shared on ElixirStatus and the web, in one email every Thursday.