Class: SystemTester::Step

Inherits:
ApplicationRecord show all
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



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

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

.bg_cssObject



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

def self.bg_css
  "teal"
end

.friendly_typeObject



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

def self.friendly_type
  name.demodulize
end

.leafsObject



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

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



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

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

.parent_typesObject



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

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



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

def self.text_css
  "white-text"
end

Instance Method Details

#bg_cssObject



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

def bg_css
  self.class.bg_css
end

#commented_titleObject



100
101
102
# File 'app/models/system_tester/step.rb', line 100

def commented_title
  title.split("\n").map { |line| "# #{line}" }.join("\n")[2..-1]
end

#friendly_typeObject



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

def friendly_type
  self.class.friendly_type
end

#moduleObject



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

def module
  ""
end

#parent_typeObject



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

def parent_type
  self.class.parent_type
end

#text_cssObject



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

def text_css
  self.class.text_css
end