appcanary / appcanary.rb

3 stars 0 forks source link

Add a callback for disabling and re-enabling mocks #23

Closed j0ni closed 7 years ago

phillmv commented 7 years ago

I'm not sure I understand why we need to make these into callbacks, rather than just providing documentation.

Anytime I would be registering a callback, I could just disable and reenable before and after the call, or in a setup block, right?

I confess I did not see how you integrated this; is there some other reason it's really convenient?

j0ni commented 7 years ago

@phillmv can you explain how you would prevent this from happening? What do you mean by "a setup block"? How do I disable and reenable it in the context of a rake task?

In our case, it happens in CI, independent of testing - so, in a separate step, outside of the test step, we would have a circle.yml line which invoked rake appcanary:check or whatever, and it will fail because RAILS_ENV is test and that causes WebMock to monkey patch Net::HTTP. In that situation, how would you prevent WebMock from monkey patching Net::HTTP before invoking the rake task?

phillmv commented 7 years ago

Poke me synchronously

mveytsman commented 7 years ago

@phillmv @j0ni what's the context of this?

phillmv commented 7 years ago

getting it to work in test envs IIRC.