Firstly, there's now an ExUnitFixtures.require_fixture_module function that will recurse a projects test tree looking for fixtures.exs files, and ensure they are loaded into a VM.
Secondly, it adds an ExUnitFixtures.AutoImport module. You can use this module in any test or fixture module, and it will reverse-traverse the directory tree looking for fixtures.exs files that contain a fixture module. These will be imported as if you had manually added use TheNameOfTheFixtureModule to your files.
This does introduce a new requirement in client code - clients using fixture modules must call ExUnitFixtures.start from their test_helper.exs file to ensure that the ExUnitFixtures application is started. This is used for registering & resolving fixture modules.
There's probably still some improvements to be made, but seems like a reasonable first pass.
This PR implements a couple of things:
ExUnitFixtures.require_fixture_module
function that will recurse a projects test tree looking forfixtures.exs
files, and ensure they are loaded into a VM.ExUnitFixtures.AutoImport
module. You can use this module in any test or fixture module, and it will reverse-traverse the directory tree looking forfixtures.exs
files that contain a fixture module. These will be imported as if you had manually addeduse TheNameOfTheFixtureModule
to your files.This does introduce a new requirement in client code - clients using fixture modules must call
ExUnitFixtures.start
from their test_helper.exs file to ensure that the ExUnitFixtures application is started. This is used for registering & resolving fixture modules.There's probably still some improvements to be made, but seems like a reasonable first pass.
Fixes #5