Class: Ace::Test::EndToEndRunner::Molecules::FixtureCopier

Inherits:
Object
  • Object
show all
Defined in:
lib/ace/test/end_to_end_runner/molecules/fixture_copier.rb

Overview

Copies fixture files from a scenario’s fixtures/ directory into a sandbox

Preserves the full directory tree structure. Used by SetupExecutor to populate sandboxes with test data files.

Note: This is a Molecule (not an Atom) because it performs filesystem I/O via FileUtils.cp_r and Dir.glob.

Instance Method Summary collapse

Instance Method Details

#copy(source_dir:, target_dir:) ⇒ Array<String>

Copy fixture tree into target directory

Parameters:

  • source_dir (String)

    Path to the fixtures/ directory

  • target_dir (String)

    Path to the sandbox directory

Returns:

  • (Array<String>)

    Relative paths of copied files and directories

Raises:

  • (ArgumentError)

    If source_dir does not exist



23
24
25
26
27
28
29
30
# File 'lib/ace/test/end_to_end_runner/molecules/fixture_copier.rb', line 23

def copy(source_dir:, target_dir:)
  raise ArgumentError, "Fixture source directory not found: #{source_dir}" unless Dir.exist?(source_dir)

  FileUtils.mkdir_p(target_dir)
  FileUtils.cp_r("#{source_dir}/.", target_dir)

  Dir.glob("**/*", base: target_dir).sort
end