Class: Strata::CLI::Generators::Test

Inherits:
Group
  • Object
show all
Defined in:
lib/strata/cli/generators/test.rb

Overview

Generates test YAML files from templates.

Constant Summary

Constants included from Output

Output::THEME

Instance Method Summary collapse

Methods inherited from Group

exit_on_failure?, source_root

Methods included from Output

format, pastel, print_error, #print_error, print_hint, #print_hint, print_info, #print_info, print_status, #print_status, print_success, #print_success, print_warning, #print_warning, shell_for, thor_color

Instance Method Details

#create_test_fileObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/strata/cli/generators/test.rb', line 14

def create_test_file
  output_path = File.join("tests", "#{slugify(name)}.yml")

  # Ensure directory exists
  empty_directory "tests"

  # Load template and update with user inputs
  template_content = load_template
  updated_content = update_template(template_content)

  # Write the updated template
  create_file output_path, updated_content

  Output.print_status(:created, output_path, type: :success, context: self)
end