ihumanable / patch

Ergonomic Mocking for Elixir
MIT License
193 stars 11 forks source link

Improves the passthrough function behavior. #43

Closed ihumanable closed 2 years ago

ihumanable commented 2 years ago

Previously if a mock function raised BadArityError or FunctionClauseError because of a bad mock, Apply would consider this to be a failed application.

This can cause confusion when a test author creates a broken mock. Instead of reporting an error about the mock code, the original code is called.

Apply has gained a new helper, direct_exception?/2 which is used to determine if the BadArityError or FunctionClauseError is being raised by the application of the function or by the code in the function.