Class: RubyRaider::MenuGenerator
- Inherits:
-
Object
- Object
- RubyRaider::MenuGenerator
- Defined in:
- lib/generators/menu_generator.rb
Class Method Summary collapse
- .choose_mobile_platform ⇒ Object
- .choose_test_framework(automation, project_name) ⇒ Object
- .generate_choice_menu(project_name) ⇒ Object
- .set_framework(automation, framework, project_name) ⇒ Object
Class Method Details
.choose_mobile_platform ⇒ Object
49 50 51 52 53 54 55 56 57 |
# File 'lib/generators/menu_generator.rb', line 49 def choose_mobile_platform @cli.choose do || .prompt = 'Please select your mobile platform' .choice('iOS') { 'appium_ios' } .choice('Android') { pp 'Android appium is coming soon. Thank you for the interest'; exit } .choice('Cross Platform') { pp 'Cross platform appium is coming soon. Thank you for the interest'; exit } .choice('Quit') { exit } end end |
.choose_test_framework(automation, project_name) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/generators/menu_generator.rb', line 19 def choose_test_framework(automation, project_name) system('clear') || system('cls') sleep 0.3 automation = automation == 'appium' ? choose_mobile_platform : automation framework = '' @cli.choose do || .prompt = 'Please select your test framework' .choice('Rspec') { framework = 'rspec'; set_framework(automation, framework, project_name) } .choice('Cucumber') do if %w[selenium watir].include? automation framework = 'cucumber' set_framework(automation, framework, project_name) else pp 'We will support iOS with cucumber on the next release' exit end end .choice('Quit') { exit } end @cli.say("You have chosen to use #{framework} with #{automation}") end |
.generate_choice_menu(project_name) ⇒ Object
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/generators/menu_generator.rb', line 8 def (project_name) @cli = HighLine.new @cli.choose do || .prompt = 'Please select your automation framework' .choice('Selenium') { choose_test_framework('selenium', project_name) } .choice('Watir') { choose_test_framework('watir', project_name) } .choice('Appium') { choose_test_framework('appium', project_name) } .choice('Quit') { exit } end end |
.set_framework(automation, framework, project_name) ⇒ Object
41 42 43 44 45 46 47 |
# File 'lib/generators/menu_generator.rb', line 41 def set_framework(automation, framework, project_name) if framework == 'rspec' RspecProjectGenerator.generate_rspec_project(automation, project_name) else CucumberProjectGenerator.generate_cucumber_project(automation, project_name) end end |