arjan / decorator

Function decorators for Elixir
MIT License
385 stars 20 forks source link

Can't Mock code used within the decorators #35

Closed sebastialonso closed 5 years ago

sebastialonso commented 5 years ago

I use Mock to, well mock, entire modules for tests. Mock duplicates entire modules with given functions to simulate original functions.

I try to mock one specific module used by my decorator, and it doesn't seem to be working. I'm assuming decorator does its magic in compile time, locking me out of the mocking in runtime.

Do you know if I can test for example, decorated controller functions bypassing the decorator?

sebastialonso commented 5 years ago

Nevermind, I was making a mistake. Either way is great to know you can mock what you use inside of a decorator!