-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Raise a helpful error if mneme was not started
- Loading branch information
1 parent
8f26e11
commit 3fe146b
Showing
5 changed files
with
43 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -93,3 +93,5 @@ jobs: | |
- run: mix deps.compile | ||
|
||
- run: mix test | ||
|
||
- run: mix test.mneme_not_started |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
defmodule Mneme.MnemeNotStartedTest do | ||
use ExUnit.Case | ||
use Mneme | ||
|
||
@tag :mneme_not_started | ||
test "error" do | ||
assert_raise RuntimeError, ~r/Did you start Mneme/, fn -> | ||
code = """ | ||
defmodule Mneme.StartedTest.ExampleTest do | ||
use ExUnit.Case | ||
use Mneme | ||
test "a test" do | ||
auto_assert 2 + 2 | ||
end | ||
end | ||
""" | ||
|
||
assert [{_, _}] = Code.compile_string(code) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,5 @@ | ||
ExUnit.start() | ||
Mneme.start() | ||
ExUnit.start(exclude: [mneme_not_started: true]) | ||
|
||
if System.get_env("START_MNEME") != "false" do | ||
Mneme.start() | ||
end |