Class: EmergeCLI::Commands::Upload::ClientLibraries::SwiftSnapshotTesting

Inherits:
Object
  • Object
show all
Defined in:
lib/commands/upload/snapshots/client_libraries/swift_snapshot_testing.rb

Instance Method Summary collapse

Constructor Details

#initialize(project_root) ⇒ SwiftSnapshotTesting

Returns a new instance of SwiftSnapshotTesting.



6
7
8
# File 'lib/commands/upload/snapshots/client_libraries/swift_snapshot_testing.rb', line 6

def initialize(project_root)
  @project_root = project_root
end

Instance Method Details

#image_filesObject



10
11
12
# File 'lib/commands/upload/snapshots/client_libraries/swift_snapshot_testing.rb', line 10

def image_files
  Dir.glob(File.join(@project_root, '**/__Snapshots__/**/*.png'))
end

#parse_file_info(image_path) ⇒ Object



14
15
16
17
18
19
20
21
22
23
# File 'lib/commands/upload/snapshots/client_libraries/swift_snapshot_testing.rb', line 14

def parse_file_info(image_path)
  file_name = image_path.split('__Snapshots__/').last
  test_class_name = File.basename(File.dirname(image_path))

  {
    file_name:,
    group_name: test_class_name.sub(/Tests$/, ''),
    variant_name: File.basename(file_name, '.*')
  }
end