Class: Dragnet::Validators::FilesValidator

Inherits:
Validator
  • Object
show all
Defined in:
lib/dragnet/validators/files_validator.rb

Overview

Validates the files key in the given Manual Test Record object. Validates:

- That the listed file(s) glob pattern(s) match at least one file in the
  repository.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(test_record, path) ⇒ FilesValidator

Creates a new instance of the class.

Parameters:

  • test_record (Dragnet::TestRecord)

    The TestRecord object whose files should be validated.

  • path (Pathname)

    The path to the repository where the files are supposed to be located.



20
21
22
23
24
# File 'lib/dragnet/validators/files_validator.rb', line 20

def initialize(test_record, path)
  @test_record = test_record
  @files = test_record.files
  @path = path
end

Instance Attribute Details

#pathObject (readonly)

Returns the value of attribute path.



13
14
15
# File 'lib/dragnet/validators/files_validator.rb', line 13

def path
  @path
end

#test_recordObject (readonly)

Returns the value of attribute test_record.



13
14
15
# File 'lib/dragnet/validators/files_validator.rb', line 13

def test_record
  @test_record
end

Instance Method Details

#validateObject

Validates the files key in the given data. Updates the file key in the given data to the actual files found in the repository.

Raises:



32
33
34
35
36
# File 'lib/dragnet/validators/files_validator.rb', line 32

def validate
  return unless files

  test_record.files = translate_paths && force_relative_paths && resolve_files
end