Closed sergey-chechaev closed 5 years ago
@sergey-chechaev, wrapping the test in capture_log
should do it. For example:
import ExUnit.CaptureLog
test "when wrong locale sets to default_locale" do
capture_log(fn ->
header_locale = "test"
build_conn()
|> put_req_header("accept", "application/json")
|> put_req_header("accept-language", header_locale)
|> AcceptLanguage.call(%{})
|> SetLocale.call(%{})
end)
assert Cldr.get_current_locale == Cldr.default_locale
end
I have the warning:
[warn] Elixir.Cldr.NoMatchingLocale: No configured locale could be matched to "test"
in my Phoenix test case:How I can test this case without warning?