Skip to content

Commit

Permalink
test: don't capture more log than necessary
Browse files Browse the repository at this point in the history
  • Loading branch information
grzuy committed Sep 9, 2024
1 parent cb4c876 commit 87f2966
Showing 1 changed file with 21 additions and 17 deletions.
38 changes: 21 additions & 17 deletions test/tower_email_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ defmodule TowerEmailTest do
use ExUnit.Case
doctest TowerEmail

import ExUnit.CaptureLog, only: [capture_log: 1]

setup do
Application.put_env(:tower, :reporters, [TowerEmail.Reporter])
Application.put_env(:tower_email, :to, "[email protected]")
Expand All @@ -13,10 +15,11 @@ defmodule TowerEmailTest do
end)
end

@tag capture_log: true
test "reports arithmetic error" do
in_unlinked_process(fn ->
1 / 0
capture_log(fn ->
in_unlinked_process(fn ->
1 / 0

Check warning on line 21 in test/tower_email_test.exs

View workflow job for this annotation

GitHub Actions / main (1.15, 25.3.2.13, swoosh_1_15)

the call to //2 will fail with ArithmeticError

Check warning on line 21 in test/tower_email_test.exs

View workflow job for this annotation

GitHub Actions / main (1.15, 25.3.2.13, swoosh_1_14)

the call to //2 will fail with ArithmeticError
end)
end)

# TODO: Support waiting on assert_email_sent with a timeout
Expand All @@ -34,21 +37,22 @@ defmodule TowerEmailTest do
)
end

@tag capture_log: true
test "reports long match error" do
in_unlinked_process(fn ->
[eleven: "eleven"] = [
one: "one",
two: "two",
three: "three",
four: "four",
five: "five",
six: "six",
seven: "seven",
eight: "eight",
nine: "nine",
ten: "ten"
]
capture_log(fn ->
in_unlinked_process(fn ->
[eleven: "eleven"] = [

Check warning on line 43 in test/tower_email_test.exs

View workflow job for this annotation

GitHub Actions / main (1.15, 25.3.2.13, swoosh_1_15)

this check/guard will always yield the same result

Check warning on line 43 in test/tower_email_test.exs

View workflow job for this annotation

GitHub Actions / main (1.15, 25.3.2.13, swoosh_1_14)

this check/guard will always yield the same result
one: "one",
two: "two",
three: "three",
four: "four",
five: "five",
six: "six",
seven: "seven",
eight: "eight",
nine: "nine",
ten: "ten"
]
end)
end)

# TODO: Support waiting on assert_email_sent with a timeout
Expand Down

0 comments on commit 87f2966

Please sign in to comment.