Searching, Sorting and Pagination in Ecto & Phoenix Rebuilding Phoenix

ExStub provides an easy way to stub a module and record the function calls executed on it.

ExStub provides an easy way to stub a module and record the function calls on it.

If you have a module in your original application like:

defmodule OriginalModule do
  def process(param), do: :original_process
  def another_method, do: :original_method
end

You can quickly create a stub copy of this module using defstub

use ExStub

defstub MyStub, for: OriginalModule do
  def process(true), do: :stubbed1
  def process(false), do: :stubbed2
  def process(1), do: :stubbed3
end

All the functions called on the defstub created module will be recorded. You can later use assert_called to check if the function was called on the stub

assert_called ModuleName.function_name

https://github.com/oarrabi/ex_stub