8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/flaky_tester/command_parser.rb', line 8
def initialize
@options = DEFAULT_OPTIONS.dup
@option_parser = OptionParser.new do |option_parser|
option_parser.banner = "Usage: fspec [options]"
option_message = "Number of times to run the test suite (default: #{DEFAULT_OPTIONS[:times]})"
option_parser.on("-t", "--times TIMES", option_message) do |times|
raise(Errors::InvalidTimes) unless valid_times?(times)
@options[:times] = times.to_i
end
option_message = "Relative path containing the tests to run (default: RSpec's default)"
option_parser.on("-p", "--path PATH", option_message) do |path|
raise(Errors::UnknownPath) unless valid_path?(path)
@options[:path] = path
end
option_parser.on("-h", "--help", "Prints command instructions") do
puts(option_parser)
exit
end
end
end
|