Class: RubyRaider::HelpersFileGenerator

Inherits:
FileGenerator show all
Defined in:
lib/generators/files/helpers_file_generator.rb

Class Method Summary collapse

Methods inherited from FileGenerator

generate_file

Class Method Details

.generate_allure_helper(framework, path) ⇒ Object



28
29
30
# File 'lib/generators/files/helpers_file_generator.rb', line 28

def generate_allure_helper(framework, path)
  generate_file('allure_helper.rb', path, AllureHelperTemplate.new(framework: framework).parsed_body)
end

.generate_browser_helper(path) ⇒ Object



32
33
34
# File 'lib/generators/files/helpers_file_generator.rb', line 32

def generate_browser_helper(path)
  generate_file('browser_helper.rb', path, BrowserHelperTemplate.new.parsed_body)
end

.generate_driver_helper(automation, path) ⇒ Object



52
53
54
# File 'lib/generators/files/helpers_file_generator.rb', line 52

def generate_driver_helper(automation, path)
  generate_file('driver_helper.rb', path, DriverHelperTemplate.new(automation: automation).parsed_body)
end

.generate_helper_files(automation, name, framework) ⇒ Object



14
15
16
17
18
19
20
21
# File 'lib/generators/files/helpers_file_generator.rb', line 14

def generate_helper_files(automation, name, framework)
  path = framework == 'rspec' ? "#{name}/helpers" : "#{name}/features/support/helpers"
  generate_raider_helper(automation, framework, path)
  generate_allure_helper(framework, path)
  generate_pom_helper(path)
  generate_spec_helper(automation, path) if framework == 'rspec'
  select_helpers(automation, path)
end

.generate_pom_helper(path) ⇒ Object



36
37
38
# File 'lib/generators/files/helpers_file_generator.rb', line 36

def generate_pom_helper(path)
  generate_file('pom_helper.rb', path, PomHelperTemplate.new.parsed_body)
end

.generate_raider_helper(automation, framework, path) ⇒ Object



23
24
25
26
# File 'lib/generators/files/helpers_file_generator.rb', line 23

def generate_raider_helper(automation, framework, path)
  generate_file('raider.rb', path,
                RaiderHelperTemplate.new(automation: automation, framework: framework).parsed_body)
end

.generate_selenium_helper(path) ⇒ Object



48
49
50
# File 'lib/generators/files/helpers_file_generator.rb', line 48

def generate_selenium_helper(path)
  generate_file('selenium_helper.rb', path, SeleniumHelperTemplate.new.parsed_body)
end

.generate_spec_helper(automation, path) ⇒ Object



40
41
42
# File 'lib/generators/files/helpers_file_generator.rb', line 40

def generate_spec_helper(automation, path)
  generate_file('spec_helper.rb', path, SpecHelperTemplate.new(automation: automation).parsed_body)
end

.generate_watir_helper(path) ⇒ Object



44
45
46
# File 'lib/generators/files/helpers_file_generator.rb', line 44

def generate_watir_helper(path)
  generate_file('watir_helper.rb', path, WatirHelperTemplate.new.parsed_body)
end

.select_helpers(automation, path) ⇒ Object



56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/generators/files/helpers_file_generator.rb', line 56

def select_helpers(automation, path)
  case automation
  when 'watir'
    generate_watir_helper(path)
    generate_browser_helper(path)
  when 'selenium'
    generate_selenium_helper(path)
    generate_driver_helper(automation, path)
  else
    generate_driver_helper(automation, path)
  end
end