Class: Dragnet::Validators::Entities::TestRecordValidator

Inherits:
Object
  • Object
show all
Defined in:
lib/dragnet/validators/entities/test_record_validator.rb

Overview

Validates a MTR object

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(test_record) ⇒ TestRecordValidator

Creates a new instance of the class.

Parameters:



22
23
24
# File 'lib/dragnet/validators/entities/test_record_validator.rb', line 22

def initialize(test_record)
  @test_record = test_record
end

Instance Attribute Details

#test_recordObject (readonly)

Returns the value of attribute test_record.



18
19
20
# File 'lib/dragnet/validators/entities/test_record_validator.rb', line 18

def test_record
  @test_record
end

Instance Method Details

#validateObject

Validates the given test record

Raises:



28
29
30
31
32
33
34
35
36
37
38
# File 'lib/dragnet/validators/entities/test_record_validator.rb', line 28

def validate
  repos_xor_files
  repos_xor_sha1

  Dragnet::Validators::Fields::IDValidator.new.validate('id', test_record.id)
  Dragnet::Validators::Fields::DescriptionValidator.new.validate('description', test_record.description)
  

  test_record.files = Dragnet::Validators::Fields::FilesValidator.new.validate('files', test_record.files)
  test_record.result = Dragnet::Validators::Fields::ResultValidator.new.validate('result', test_record.result)
end