Class: TestBench::Run::Summary::FileInfo

Inherits:
Struct
  • Object
show all
Defined in:
lib/test_bench/run/summary.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#aborted_eventsObject

Returns the value of attribute aborted_events

Returns:

  • (Object)

    the current value of aborted_events



352
353
354
# File 'lib/test_bench/run/summary.rb', line 352

def aborted_events
  @aborted_events
end

#file_pathObject

Returns the value of attribute file_path

Returns:

  • (Object)

    the current value of file_path



352
353
354
# File 'lib/test_bench/run/summary.rb', line 352

def file_path
  @file_path
end

#not_foundObject

Returns the value of attribute not_found

Returns:

  • (Object)

    the current value of not_found



352
353
354
# File 'lib/test_bench/run/summary.rb', line 352

def not_found
  @not_found
end

#statusObject

Returns the value of attribute status

Returns:

  • (Object)

    the current value of status



352
353
354
# File 'lib/test_bench/run/summary.rb', line 352

def status
  @status
end

Class Method Details

.initial(file_path) ⇒ Object



353
354
355
356
357
358
359
# File 'lib/test_bench/run/summary.rb', line 353

def self.initial(file_path)
  status = Session::Status.initial

  aborted_events = []

  new(file_path, status, aborted_events)
end

.not_found(file_path) ⇒ Object



361
362
363
364
365
# File 'lib/test_bench/run/summary.rb', line 361

def self.not_found(file_path)
  instance = new(file_path)
  instance.not_found = true
  instance
end

Instance Method Details

#errorsObject



416
417
418
419
420
# File 'lib/test_bench/run/summary.rb', line 416

def errors
  errors = aborted_events.count

  "%i error#{'s' if errors != 1}:" % errors
end

#errors?Boolean

Returns:

  • (Boolean)


412
413
414
# File 'lib/test_bench/run/summary.rb', line 412

def errors?
  aborted_events.any?
end

#failed?Boolean

Returns:

  • (Boolean)


375
376
377
378
379
380
381
382
383
384
385
386
# File 'lib/test_bench/run/summary.rb', line 375

def failed?
  if not_found?
    return true
  end

  case status.result
  when Session::Result.failed, Session::Result.aborted
    true
  else
    false
  end
end

#failuresObject



396
397
398
399
400
# File 'lib/test_bench/run/summary.rb', line 396

def failures
  failures = status.failure_sequence

  "%i failure#{'s' if failures != 1}" % failures
end

#failures?Boolean

Returns:

  • (Boolean)


392
393
394
# File 'lib/test_bench/run/summary.rb', line 392

def failures?
  status.failure_sequence > 0
end

#not_found?Boolean

Returns:

  • (Boolean)


422
423
424
# File 'lib/test_bench/run/summary.rb', line 422

def not_found?
  not_found ? true : false
end

#skippedObject



406
407
408
409
410
# File 'lib/test_bench/run/summary.rb', line 406

def skipped
  skipped = status.skip_sequence

  "%i+ skipped" % skipped
end

#skipped?Boolean

Returns:

  • (Boolean)


402
403
404
# File 'lib/test_bench/run/summary.rb', line 402

def skipped?
  status.skip_sequence > 0
end

#tests?Boolean

Returns:

  • (Boolean)


388
389
390
# File 'lib/test_bench/run/summary.rb', line 388

def tests?
  status.test_sequence > 0
end

#update(event) ⇒ Object



367
368
369
370
371
372
373
# File 'lib/test_bench/run/summary.rb', line 367

def update(event)
  status.update(event)

  if event in Aborted => aborted
    self.aborted_events << aborted
  end
end