There are times when you might want to change your environment variables within a testing environment. Maybe you want to communicate with a different server or want to enable some kind of functionality that is normally disabled for testing. You can use stubbing to elegantly and temporarily just set your environment variables within a test.
Here, I am enabling a feature that allows us to access user information. Normally, the lookup is computationally expensive so we don’t run it on all of our tests. But when the need arises, it’s good to be able to change your environment variables easily within a single test.