We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 89e22d7 commit 758623eCopy full SHA for 758623e
lib/mox.ex
@@ -597,6 +597,16 @@ defmodule Mox do
597
stub(MockWeatherAPI, :get_temp, fn _loc -> {:ok, 30} end)
598
599
`stub/3` will overwrite any previous calls to `stub/3`.
600
+
601
+ > #### Warning {: .warning}
602
+ >
603
+ > `stub/3` does **not verify that a call occurred**.
604
+ > If the code stops calling the stubbed function
605
+ > (for example, after a refactor), the test will still pass.
606
607
+ > This can lead to unused stubs lingering in tests.
608
+ > Always use `expect/3` when you want to ensure the
609
+ > function is actually invoked.
610
"""
611
@spec stub(mock, atom(), function()) :: mock when mock: t()
612
def stub(mock, name, code)
0 commit comments