Class: SystemTester::Step

Inherits:
ApplicationRecord show all
Includes:
TitleValidatable
Defined in:
app/models/system_tester/step.rb

Direct Known Subclasses

Action, Assertion, Stair

Constant Summary collapse

INDENT =
" " * 6

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.argsObject



55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'app/models/system_tester/step.rb', line 55

def self.args
  [
    {
      name: 'arg_one',
      label: 'One',
      type: 'text'
    },
    {
      name: 'arg_two',
      label: 'Two',
      type: 'text'
    }
  ]
end

.bg_cssObject



27
28
29
# File 'app/models/system_tester/step.rb', line 27

def self.bg_css
  "teal"
end

.friendly_typeObject



19
20
21
# File 'app/models/system_tester/step.rb', line 19

def self.friendly_type
  name.demodulize
end

.leafsObject



70
71
72
73
74
75
76
77
78
79
# File 'app/models/system_tester/step.rb', line 70

def self.leafs
  (descendants - direct_descendants).map do |desc|
    {
      name: desc.to_s,
      friendly: desc.friendly_type,
      parent: desc.parent_type,
      args: desc.args
    }
  end.sort_by { |step_type| [step_type[:parent_type], step_type[:friendly]] }
end

.parent_typeObject



23
24
25
# File 'app/models/system_tester/step.rb', line 23

def self.parent_type
  ancestors.fourth.name.demodulize
end

.parent_typesObject



81
82
83
84
85
86
87
88
# File 'app/models/system_tester/step.rb', line 81

def self.parent_types
  direct_descendants.map do |desc|
    {
      name: desc.to_s,
      friendly: desc.friendly_type
    }
  end.sort_by { |step_type| step_type[:friendly] }
end

.text_cssObject



31
32
33
# File 'app/models/system_tester/step.rb', line 31

def self.text_css
  "white-text"
end

Instance Method Details

#bg_cssObject



43
44
45
# File 'app/models/system_tester/step.rb', line 43

def bg_css
  self.class.bg_css
end

#friendly_typeObject



35
36
37
# File 'app/models/system_tester/step.rb', line 35

def friendly_type
  self.class.friendly_type
end

#moduleObject



51
52
53
# File 'app/models/system_tester/step.rb', line 51

def module
  ""
end

#parent_typeObject



39
40
41
# File 'app/models/system_tester/step.rb', line 39

def parent_type
  self.class.parent_type
end

#text_cssObject



47
48
49
# File 'app/models/system_tester/step.rb', line 47

def text_css
  self.class.text_css
end