thoughtbot/fake_braintree — pull request #75 by mislav (2014-12-07 02:09:19+00:00)
Title: Only `require` modules that the current file directly interfaces with

When working on my PR about port numbers, I have noticed that individual files don't require their direct dependencies. Here I propose that #70 gets reverted and the library goes back to declaring dependencies in each individual file based on what that module directly interfaces with.

This has several advantages:

- When looking at a source file, it's immediately obvious what are its dependencies to Ruby stdlib or 3rd-party libraries.

- When changing a specific module in a way that one of the dependencies is no longer necessary, its easier to remember to remove the associated `require`. If all `require`s are in the main library file, in the long term it can be difficult to determine whether each of the require's are still needed.

- Instead of loading whole of `active_support/core_ext`, cherry-pick parts of it that we need in the current file.

I also hoped that instead of loading whole of `capybara`, we could get away with loading just `capybara/server`, because that's the only component of Capybara that we actually need. However, because of Capybara::Server interfaces with global Capybara configuration (namely `Capybara.server`), that's wasn't possible.