
Why constant mocking in RSpec is bad - hqc
https://hqc.io/2017/03/26/constant-mocking-is-bad.html
======
al2o3cr

        What if there are some core classes or third-party
        libraries we use also require Time.now to work?
    

The "once" expectation will fail, indicating that the mock doesn't accurately
represent the behavior of the system?

Note that in the DI case, unless there's additional work being done to inject
the double everywhere else `Time.now` gets used the spec will silently use the
built-in version.

~~~
hqc
Yeah that kind of test tends to be fragile and the outcome is unpredictable.

There's no need to inject the double everywhere in other tests because the
built-in version is the behavior we want the function to work.

