       assert_receive {:count, ^x}
 
   """
-  defmacro assert_receive(expected,
+  defmacro assert_receive(pattern,
                           timeout \\ Application.fetch_env!(:ex_unit, :assert_receive_timeout),
-                          message \\ nil) do
-    do_assert_receive(expected, timeout, message, __CALLER__)
-  end
-
-  @doc """
-  Asserts a message was received and is in the current process' mailbox.
+                          failure_message \\ nil) do
+    do_assert_receive(pattern, timeout, failure_message, __CALLER__)
+  end
+
+  @doc """
+  Asserts that a message matching `pattern` was received and is in the
+  current process' mailbox.
+
+  The `pattern` argument must be a match pattern. Flunks with `failure_message`
+  if a message matching `pattern` was not received.
+
   Timeout is set to 0, so there is no waiting time.
-
-  The `expected` argument is a pattern.
 
   ## Examples
 
       send self, :hello
       assert_received :hello
 
+      send self, :bye
+      assert_received :hello, "Oh No!"
+      ** (ExUnit.AssertionError) Oh No!
+      Process mailbox:
+        :bye
+
   You can also match against specific patterns:
 
       send self, {:hello, "world"}
       assert_received {:hello, _}
 
   """
-  defmacro assert_received(expected, message \\ nil) do
-    do_assert_receive(expected, 0, message, __CALLER__)
-  end
-
-  defp do_assert_receive(expected, timeout, message, caller) do
-    binary = Macro.to_string(expected)
+  defmacro assert_received(pattern, failure_message \\ nil) do
+    do_assert_receive(pattern, 0, failure_message, __CALLER__)
+  end
+
+  defp do_assert_receive(pattern, timeout, failure_message, caller) do
+    binary = Macro.to_string(pattern)
 
     # Expand before extracting metadata
-    expected = Macro.expand(expected, caller)
-    vars = collect_vars_from_pattern(expected)
-    pins = collect_pins_from_pattern(expected)
+    pattern = Macro.expand(pattern, caller)
+    vars = collect_vars_from_pattern(pattern)
+    pins = collect_pins_from_pattern(pattern)
 
     pattern =
-      case expected do
+      case pattern do
         {:when, meta, [left, right]} ->
           {:when, meta, [quote(do: unquote(left) = received), right]}
         left ->

    end
  end

 defp refute_receive_clause(not_expected, nil) do
  binary = Macro.to_string(not_expected)
  quote do
    unquote(not_expected) = actual ->
      flunk "Unexpectedly received message #{inspect actual} (which matched #{unquote binary})"
    end
  end

  defp refute_receive_clause(not_expected, message) do
    quote do
      unquote(not_expected) -> flunk unquote(message)
    end
  end


      refute_receive :bye, 1000

  """
  defmacro refute_receive(pattern,
                          timeout \\ Application.fetch_env!(:ex_unit, :refute_receive_timeout),
                          failure_message \\ nil) do
    do_refute_receive(pattern, timeout, failure_message)
  end

  @doc """
  Asserts a message matching `pattern` was not received (i.e. it is not in the
  current process' mailbox).

  The `pattern` argument must be a match pattern. Flunks with `failure_message`
  if a message matching `pattern` was received.

  Timeout is set to 0, so there is no waiting time.

