Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 76fb799949
Fetching contributors…

Cannot retrieve contributors at this time

file 39 lines (31 sloc) 0.794 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
Mix.start
Mix.env(:dev)
Mix.shell(Mix.Shell.Process)
System.put_env("MIX_ENV", "dev")

Dynamo.start(:dev, __FILE__)
ExUnit.start

defmodule MixHelpers do
  import ExUnit.Assertions

  def tmp_path do
    File.expand_path("../../tmp", __FILE__)
  end

  def tmp_path(extension) do
    File.join tmp_path, extension
  end

  def in_tmp(which, function) do
    path = tmp_path(which)
    File.rm_rf! path
    File.mkdir_p! path
    File.cd! path, function
  end

  def assert_file(file) do
    assert File.regular?(file), "Expected #{file} to exist, but does not"
  end

  def assert_file(file, match) when is_regex(match) do
    assert_file file, &1 =~ match
  end

  def assert_file(file, callback) when is_function(callback, 1) do
    assert_file(file)
    callback.(File.read!(file))
  end
end
Something went wrong with that request. Please try again.