Class: TestData::SecretsYamlGenerator

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

Instance Method Summary collapse

Instance Method Details

#callObject



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/generators/test_data/secrets_yaml_generator.rb', line 6

def call
  unless Configurators::SecretsYaml.new.verify.looks_good?
    inject_into_file "config/secrets.yml", before: BEFORE_TEST_STANZA_REGEX do
      "\n        # Simplify configuration with the test_data environment\n        test_data:\n          secret_key_base: \#{SecureRandom.hex(64)}\n      YAML\n    end\n  end\nend\n"