Class: Dragnet::Verifier

Inherits:
Object
  • Object
show all
Defined in:
lib/dragnet/verifier.rb

Overview

Executes the verification process on the given Test Records

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(test_records:, repository:, logger:) ⇒ Verifier

Creates a new instance of the class.

Parameters:

  • test_records (Array<Hash>)

    An array with the test records.

  • repository (Dragnet::Repository)

    The repository where the MTR and the source files are stored.

  • logger (#info)

    The logger object to use for output.



17
18
19
20
21
# File 'lib/dragnet/verifier.rb', line 17

def initialize(test_records:, repository:, logger:)
  @test_records = test_records
  @repository = repository
  @logger = logger
end

Instance Attribute Details

#loggerObject (readonly)

Returns the value of attribute logger.



10
11
12
# File 'lib/dragnet/verifier.rb', line 10

def logger
  @logger
end

#pathObject (readonly)

Returns the value of attribute path.



10
11
12
# File 'lib/dragnet/verifier.rb', line 10

def path
  @path
end

#test_recordsObject (readonly)

Returns the value of attribute test_records.



10
11
12
# File 'lib/dragnet/verifier.rb', line 10

def test_records
  @test_records
end

Instance Method Details

#verifyObject

Runs the verify process After the execution of this method each Test Record will get a :result key with the result of the verification process. This key contains a hash like the following:

result: {
  status: :passed,     # Either :passed, :failed or :skipped
  reason: 'String'     # The reason for the failure (for :failed and :skipped)
}


32
33
34
35
36
37
38
# File 'lib/dragnet/verifier.rb', line 32

def verify
  logger.info 'Verifying MTR files...'
  test_records.each do |test_record|
    logger.info "Verifying #{test_record.source_file}"
    verify_mtr(test_record)
  end
end