summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@plataformatec.com.br>2016-09-29 11:01:01 +0200
committerJosé Valim <jose.valim@plataformatec.com.br>2016-09-29 11:01:18 +0200
commitaef130c0ebaab148390ca87f93bb0c56ddf0eb2e (patch)
tree5183db1b75f04fa200f000a4e9e7c01f93f44a08
parent5054a26145b79c93c0c0fb781d3af7343c412b79 (diff)
downloadelixir-aef130c0ebaab148390ca87f93bb0c56ddf0eb2e.tar.gz
Check for both error messages when testing race conditions
-rw-r--r--lib/ex_unit/test/ex_unit/assertions_test.exs6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/ex_unit/test/ex_unit/assertions_test.exs b/lib/ex_unit/test/ex_unit/assertions_test.exs
index ac999608e..9186ca5c2 100644
--- a/lib/ex_unit/test/ex_unit/assertions_test.exs
+++ b/lib/ex_unit/test/ex_unit/assertions_test.exs
@@ -160,7 +160,8 @@ defmodule ExUnit.AssertionsTest do
test "assert receive with message in mailbox after timeout, but before reading mailbox tells user to increase timeout" do
parent = self()
- # this is testing a race condition, so it's not guaranteed this works under all loads of the system
+ # This is testing a race condition, so it's not
+ # guaranteed this works under all loads of the system
timeout = 100
spawn fn -> Process.send_after parent, :hello, timeout end
@@ -168,7 +169,8 @@ defmodule ExUnit.AssertionsTest do
assert_receive :hello, timeout
rescue
error in [ExUnit.AssertionError] ->
- "Found message matching :hello after 100ms" <> _ = error.message
+ true = error.message =~ "Found message matching :hello after 100ms" or
+ error.message =~ "No message matching :hello after 100ms"
end
end