6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
# File 'lib/generators/test_data/database_yaml_generator.rb', line 6
def call
if Configurators::DatabaseYaml.new.verify.looks_good?
TestData.log.info "'test_data' section already defined in config/database.yml"
else
app_name = Rails.application.railtie_name.chomp("_application")
inject_into_file "config/database.yml", before: BEFORE_TEST_STANZA_REGEX do
"\n # Used in conjunction with the test_data gem\n test_data:\n <<: *default\n database: \#{app_name}_test_data\n YAML\n end\n end\nend\n"
|