How to enable Rails' file_fixture helper in FactoryBot
This is now build-in into factory_bot_rails https://github.com/thoughtbot/factory_bot_rails/pull/427/files
In FactoryBot factories, Rails' file_fixture
is not available by default. To enable it, include a support module from rspec-rails:
FactoryBot::SyntaxRunner.include(RSpec::Rails::FileFixtureSupport)
That includes ActiveSupport::Testing::FileFixtures
, where file_fixture
is defined, but also configures the file_fixture_path
so that you can actually use file_fixture
.