Class: RSpec::Parallel::Parser
- Inherits:
-
Core::Parser
- Object
- Core::Parser
- RSpec::Parallel::Parser
- Defined in:
- lib/rspec/parallel/option_parser.rb
Instance Method Summary collapse
Instance Method Details
#parse!(args) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/rspec/parallel/option_parser.rb', line 4 def parse!(args) return {} if args.empty? convert_deprecated_args(args) = args.delete('--tty') ? {:tty => true} : {} delete_next = false removed_parallel = false parallel_value = nil args.delete_if do |arg| if delete_next parallel_value = arg true elsif arg == '--parallel-test' delete_next = true removed_parallel = true true end end begin parser(, true).parse!(args) if removed_parallel args.push '--parallel-test' args.push parallel_value parser().parse!(args) end rescue OptionParser::InvalidOption => e abort "#{e.}\n\nPlease use --help for a listing of valid options" end end |
#parser(options, bypass = false) ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/rspec/parallel/option_parser.rb', line 37 def parser(, bypass = false) if bypass super() else OptionParser.new do |parser| parser. = "\n **** Parallel Testing ****\n\n" parser.on('--parallel-test NUMBER', Integer, 'Run the tests with the specified number of parallel threads (default: 1).') do |n| [:thread_maximum] = n || 1 end end end end |