Skip to content

Commit 14e0d4d

Browse files
committed
Add tests
1 parent 5c68e71 commit 14e0d4d

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

test/error_tracker/ignorer_test.exs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
defmodule ErrorTracker.IgnorerTest do
2+
use ErrorTracker.Test.Case
3+
4+
setup_all do
5+
Application.put_env(:error_tracker, :ignorer, ErrorTracker.EveryErrorIgnorer)
6+
end
7+
8+
test "ignores errors" do
9+
refute report_error(fn -> raise "[IGNORE] Sample error" end)
10+
assert report_error(fn -> raise "Sample error" end)
11+
end
12+
end
13+
14+
defmodule ErrorTracker.EveryErrorIgnorer do
15+
@behaviour ErrorTracker.Ignorer
16+
17+
@impl true
18+
def ignore?(error, _context) do
19+
String.contains?(error.reason, "[IGNORE]")
20+
end
21+
end

0 commit comments

Comments
 (0)