In a future chapter, we will see why we are removing fixtures. For now, let's just go ahead and disable the fixtures.
To disable using fixtures open test/test_helper.rb and comment out the line shown below.
1# fixtures :allExecute the following lines on the terminal to delete the fixtures folder completely:
1rm -rf test/fixturesEnsure fixtures won't get generated
Rails provide several generator commands that help in generating boilerplate code for models, controllers, migration scripts, etc. We will be using them throughout the book.
But, with some of those generators, fixture files also get generated by default. We won't need those fixture files.
Fortunately, we can customize Rails generators to disable the auto-generation of fixtures for all the commands.
To do that, add the following lines in config/application.rb:
1require_relative 'boot'
2require 'rails/all'
3
4Bundler.require(*Rails.groups)
5
6module Granite
7 class Application < Rails::Application
8 # previous code if any
9
10 config.generators do |g|
11 g.test_framework :test_unit, fixture: false
12 end
13 end
14endFor simple applications, we can always rely on using ActiveRecord queries to create seed data for tests instead of fixtures. We will learn about them in the upcoming chapters.
