File tree Expand file tree Collapse file tree 1 file changed +17
-3
lines changed Expand file tree Collapse file tree 1 file changed +17
-3
lines changed Original file line number Diff line number Diff line change 1
1
defmodule ErrorTracker.IgnorerTest do
2
2
use ErrorTracker.Test.Case
3
3
4
- setup_all do
5
- Application . put_env ( :error_tracker , :ignorer , ErrorTracker.EveryErrorIgnorer )
4
+ setup context do
5
+ if ignorer = context [ :ignorer ] do
6
+ previous_setting = Application . get_env ( :error_tracker , :ignorer )
7
+ Application . put_env ( :error_tracker , :ignorer , ignorer )
8
+ # Ensure that the application env is restored after each test
9
+ on_exit ( fn -> Application . put_env ( :error_tracker , :ignorer , previous_setting ) end )
10
+ end
11
+
12
+ [ ]
6
13
end
7
14
8
- test "ignores errors" do
15
+ @ tag ignorer: ErrorTracker.EveryErrorIgnorer
16
+ test "with an ignorer ignores errors" do
9
17
refute report_error ( fn -> raise "[IGNORE] Sample error" end )
10
18
assert report_error ( fn -> raise "Sample error" end )
11
19
end
20
+
21
+ @ tag ignorer: false
22
+ test "without an ignorer does not ignore errors" do
23
+ assert report_error ( fn -> raise "[IGNORE] Sample error" end )
24
+ assert report_error ( fn -> raise "Sample error" end )
25
+ end
12
26
end
13
27
14
28
defmodule ErrorTracker.EveryErrorIgnorer do
You can’t perform that action at this time.
0 commit comments