Class: Kinchan::Task
- Inherits:
-
Object
- Object
- Kinchan::Task
- Defined in:
- lib/kinchan.rb
Overview
A single unit of automation in Kinchan
Class Method Summary collapse
- .find_task(task_symbol) ⇒ Object
- .inherited(subclass) ⇒ Object
- .restart_browser ⇒ Object
- .start_browser ⇒ Object
Instance Method Summary collapse
- #execute(_browser) ⇒ Object
-
#initialize(**options) ⇒ Task
constructor
A new instance of Task.
- #run ⇒ Object
Constructor Details
#initialize(**options) ⇒ Task
Returns a new instance of Task.
40 41 42 43 44 45 46 |
# File 'lib/kinchan.rb', line 40 def initialize(**) @before_tasks = [] @after_tasks = [] @options = Task.start_browser unless defined?(@@browser_webdriver) end |
Class Method Details
.find_task(task_symbol) ⇒ Object
52 53 54 |
# File 'lib/kinchan.rb', line 52 def self.find_task(task_symbol) Task.descendants.select { |task| task.name.split('::').last.downcase == task_symbol.to_s.downcase }[0] end |
.inherited(subclass) ⇒ Object
48 49 50 |
# File 'lib/kinchan.rb', line 48 def self.inherited(subclass) Task.descendants << subclass end |
Instance Method Details
#execute(_browser) ⇒ Object
74 |
# File 'lib/kinchan.rb', line 74 def execute(_browser); end |
#run ⇒ Object
76 77 78 79 80 |
# File 'lib/kinchan.rb', line 76 def run run_tasks(@before_tasks) execute(@@browser_webdriver) run_tasks(@after_tasks) end |