FauxRedis.Case (faux_redis v1.0.3)

Copy Markdown View Source

ExUnit case template that spins up an isolated FauxRedis server per test.

Usage:

defmodule MyTest do
  use FauxRedis.Case, async: true

  test "example", %{redis_server: server, redis_port: port} do
    {:ok, _rule} = FauxRedis.stub(server, :get, "value")
    assert is_integer(port)
  end
end

Summary

Functions

Convenience wrapper around FauxRedis.expect/3 that reads the server from the test context.

Convenience wrapper around FauxRedis.stub/3 that reads the server from the test context.

Functions

expect(map, matcher, response)

@spec expect(map(), FauxRedis.matcher(), FauxRedis.response_spec()) ::
  {:ok, reference()}

Convenience wrapper around FauxRedis.expect/3 that reads the server from the test context.

stub(map, matcher, response)

@spec stub(map(), FauxRedis.matcher(), FauxRedis.response_spec()) ::
  {:ok, reference()}

Convenience wrapper around FauxRedis.stub/3 that reads the server from the test context.