Automatically swap references from FactoryBot's create
to build
in tests to speed up test runs by using in-memory objects (in the sky) rather than hitting the database (down below).
"Design can emerge from mere Order via an algorithmic process that makes no use of pre-existing Mind. Sceptics have hoped to show that at least somewhere in this process a helping hand (more accurately, a helping mind) must have been provided—a skyhook to do some of the lifting."—Daniel Dennett (Darwin's Dangerous Idea: Evolution and the Meanings of Life. p.83)
"It's a horror movie right there on my TV"—Greg Macainsh
$ brew tap thoran/tap
$ brew install thoran/tap/skyhooks
$ cd <repo_name>
$ skyhooks
- Fork it:
https://github.com/thoran/skyhooks/fork
- Create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -am 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Create a new pull request
- Use
build_stubbed
in preference tobuild
as it is lighter weight. - At present this will change all instances of
create
tobuild
in a file, such that opportunities to change some instances will be missed. So, use a binary search algorithm within a file, so as to be able to alter those files where some instances ofcreate
can be swapped out, but not all. - Change instances of
build
tobuild_stubbed
.