Class: TestData::InitializerGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/test_data/initializer_generator.rb

Instance Method Summary collapse

Instance Method Details

#callObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/generators/test_data/initializer_generator.rb', line 6

def call
  create_file "config/initializers/test_data.rb", "    return unless defined?(TestData)\n\n    TestData.config do |config|\n      # Hook run after test data is loaded by `TestData.uses_test_data`,\n      #   but before a savepoint is taken\n      # config.after_test_data_load { }\n\n      # Hook run after test data is truncated by `TestData.uses_clean_slate`,\n      #   but before a savepoint is taken\n      # config.after_test_data_truncate { }\n\n      # Hook run after test data is truncated by `TestData.uses_rails_fixtures`,\n      #   but before a savepoint is taken\n      # config.after_rails_fixture_load { }\n\n      # Tables whose data shouldn't be loaded into tests.\n      #   (\"ar_internal_metadata\" and \"schema_migrations\" are always excluded)\n      # config.non_test_data_tables = []\n\n      # Tables whose data should be excluded from SQL dumps (still dumps their schema DDL)\n      # config.dont_dump_these_tables = []\n\n      # Where to store SQL dumps of the test_data database schema\n      # config.schema_dump_path = \"test/support/test_data/schema.sql\"\n\n      # Where to store SQL dumps of the test_data database test data\n      # config.data_dump_path = \"test/support/test_data/data.sql\"\n\n      # Where to store SQL dumps of the test_data database non-test data\n      # config.non_test_data_dump_path = \"test/support/test_data/non_test_data.sql\"\n\n      # Tables whose data should be truncated by TestData.uses_clean_slate\n      #   If left as `nil`, all tables inserted into by the SQL file at\n      #   `data_dump_path` will be truncated\n      # config.truncate_these_test_data_tables = nil\n\n      # Log level (valid values: [:debug, :info, :warn, :error, :quiet])\n      #   Can also be set with env var TEST_DATA_LOG_LEVEL\n      # config.log_level = :info\n    end\n  RUBY\nend\n"