Skip to content

u2i/cachex_sandbox

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CachexSandbox

Test isolation for Cachex. Each test gets its own clean cache.

Setup

# mix.exs
{:cachex_sandbox, "~> 0.1", only: :test}

# test/test_helper.exs
CachexSandbox.start([:my_cache])

Usage

use ExUnit.Case, async: true
use CachexSandbox.Case

test "isolated cache", %{caches: caches} do
  Cachex.put(caches[:my_cache], "key", "value")
  # Other tests won't see this
end

Your app reads the cache name from config:

def cache_name, do: Application.get_env(:my_app, :cache, :my_cache)

About

Pool of Cachex instances for test isolation. Each test gets its own clean cache.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages