Skip to content

Fix module and function names in documentation examples - #180

Merged
josevalim merged 1 commit into
dashbitco:mainfrom
dajiaohuang:docs/weather-example-names-20261016
Oct 16, 2026
Merged

josevalim merged 1 commit into
dashbitco:mainfrom
dajiaohuang:docs/weather-example-names-20261016

Conversation

@dajiaohuang

Copy link
Copy Markdown
Contributor

Summary

Use the module and function names defined earlier in the module documentation:

  • The multiple-behaviour example passes MyApp.Weather to defmock/2, but the behaviour is named MyApp.WeatherAPI. Evaluating the snippet with the preceding definitions raises ArgumentError (could not load module MyApp.Weather, :nofile).
  • Both blocking-on-expectations snippets call MyApp.HumanizedWeather.temp/1, but that module defines display_temp/1. The documented call raises UndefinedFunctionError before invoking the mock.

This changes only those three references, leaving the examples' synchronization explanation and the runtime implementation unchanged.

Validation

On Elixir 1.18.4 / OTP 25:

  • Extracted documentation snippets: both fail on the base revision and pass with these corrections (multiple-behaviour mock calls; owned child invoking the documented weather expression).
  • mix test test/mox_test.exs --seed 0: 76 tests, 0 failures.
  • mix format --check-formatted
  • mix deps.unlock --check-unused
  • mix compile --warnings-as-errors
  • git diff --check

Did not run test/cluster_test.exs or the full Elixir/OTP matrix. No external weather request was made.

@josevalim
josevalim merged commit a3bed63 into dashbitco:main Oct 16, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants