Class: Inferno::Repositories::TestSessions::Model

Inherits:
Object
  • Object
show all
Defined in:
lib/inferno/repositories/test_sessions.rb

Instance Method Summary collapse

Instance Method Details

#before_createObject



73
74
75
76
77
78
79
# File 'lib/inferno/repositories/test_sessions.rb', line 73

def before_create
  self.id = SecureRandom.uuid
  time = Time.now
  self.created_at ||= time
  self.updated_at ||= time
  super
end

#validateObject



81
82
83
84
85
86
87
# File 'lib/inferno/repositories/test_sessions.rb', line 81

def validate
  super
  errors.add(:test_suite_id, 'cannot be empty') if test_suite_id.blank?
  unless test_suites_repo.exists? test_suite_id # rubocop:disable Style/GuardClause
    errors.add(:test_suite_id, "'#{test_suite_id}' is not valid")
  end
end