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



64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'app/models/system_tester/step.rb', line 64

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

.bg_cssObject



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

def self.bg_css
  "teal"
end

.friendly_typeObject



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

def self.friendly_type
  name.demodulize
end

.leafsObject



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

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



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

def self.parent_type
  ancestors.fourth.name ? ancestors.fourth.name.demodulize : "Step"
end

.parent_typesObject



90
91
92
93
94
95
96
97
# File 'app/models/system_tester/step.rb', line 90

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



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

def self.text_css
  "white-text"
end

Instance Method Details

#bg_cssObject



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

def bg_css
  self.class.bg_css
end

#friendly_typeObject



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

def friendly_type
  self.class.friendly_type
end

#moduleObject



60
61
62
# File 'app/models/system_tester/step.rb', line 60

def module
  ""
end

#parent_typeObject



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

def parent_type
  self.class.parent_type
end

#text_cssObject



56
57
58
# File 'app/models/system_tester/step.rb', line 56

def text_css
  self.class.text_css
end