Class: CaseManager

Inherits:
Object
  • Object
show all
Includes:
Utils
Defined in:
lib/teuton/case_manager/case_manager.rb,
lib/teuton/case_manager/report.rb,
lib/teuton/case_manager/check_cases.rb,
lib/teuton/case_manager/hall_of_fame.rb

Overview

This class does all the job Organize the hole job, sending orders to others classes

  • initialize

  • play

Split into several files:

  • case_manager/check_cases

  • case_manager/export

  • case_manager/hall_of_fame

  • case_manager/report

Defined Under Namespace

Classes: HallOfFame

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Utils

#encode_and_split, #ensure_dir, #my_execute, #verbose, #verboseln

Constructor Details

#initializeCaseManager

Returns a new instance of CaseManager.



25
26
27
28
29
# File 'lib/teuton/case_manager/case_manager.rb', line 25

def initialize
  @cases = []
  @report = Report.new(0)
  @report.filename = "resume"
end

Instance Attribute Details

#casesObject (readonly)

Returns the value of attribute cases.



23
24
25
# File 'lib/teuton/case_manager/case_manager.rb', line 23

def cases
  @cases
end

#reportObject (readonly)

Returns the value of attribute report.



23
24
25
# File 'lib/teuton/case_manager/case_manager.rb', line 23

def report
  @report
end

Instance Method Details

#export(args = {}) ⇒ Object



44
45
46
# File 'lib/teuton/case_manager/case_manager.rb', line 44

def export(args = {})
  ExportManager.new.call(@report, @cases, args)
end

#play(&block) ⇒ Object

Execute “play” order: Start every single case test



33
34
35
36
37
38
39
40
41
42
# File 'lib/teuton/case_manager/case_manager.rb', line 33

def play(&block)
  check_cases!
  instance_eval(&block)
  # Run export if user pass option command "--export=json"
  i = Application.instance.options["export"]
  export(format: i.to_sym) unless i.nil?
  # Accept "configfile" param REVISE There exists?
  i = Application.instance.options["configfile"]
  export(format: i.to_sym) unless i.nil?
end

#send(args = {}) ⇒ Object



48
49
50
# File 'lib/teuton/case_manager/case_manager.rb', line 48

def send(args = {})
  SendManager.new.call(@cases, args)
end

#show(options = {verbose: 1}) ⇒ Object



52
53
54
# File 'lib/teuton/case_manager/case_manager.rb', line 52

def show(options = {verbose: 1})
  ShowReport.new(@report).call(options[:verbose])
end