Rspec Steps C0 Coverage Information - RCov

rcov/ruby/1.8/gems/rspec-core-2.5.1/lib/rspec/core/option_parser.rb

Name Total Lines Lines of Code Total Coverage Code Coverage
rcov/ruby/1.8/gems/rspec-core-2.5.1/lib/rspec/core/option_parser.rb 132 107
64.39%
57.94%

Key

Code reported as executed by Ruby looks like this...and this: this line is also marked as covered.Lines considered as run by rcov, but not reported by Ruby, look like this,and this: these lines were inferred by rcov (using simple heuristics).Finally, here's a line marked as not executed.

Coverage Details

1 module RSpec::Core
2   class Parser
3     def self.parse!(args)
4       new.parse!(args)
5     end
6 
7     class << self
8       alias_method :parse, :parse!
9     end
10 
11     def parse!(args)
12       return {} if args.empty?
13       if args.include?("--formatter")
14         RSpec.deprecate("the --formatter option", "-f or --format")
15         args[args.index("--formatter")] = "--format"
16       end
17       options = {}
18       parser(options).parse!(args)
19       options
20     end
21 
22     alias_method :parse, :parse!
23 
24     def parser(options)
25       OptionParser.new do |parser|
26         parser.banner = "Usage: rspec [options] [files or directories]\n\n"
27 
28         parser.on('-b', '--backtrace', 'Enable full backtrace') do |o|
29           options[:full_backtrace] = true
30         end
31 
32         parser.on('-c', '--[no-]color', '--[no-]colour', 'Enable color in the output') do |o|
33           options[:color_enabled] = o
34         end
35 
36         parser.on('-d', '--debug', 'Enable debugging') do |o|
37           options[:debug] = true
38         end
39 
40         parser.on('-e', '--example PATTERN', "Run examples whose full descriptions match this pattern",
41                 "(PATTERN is compiled into a Ruby regular expression)") do |o|
42           options[:full_description] = /#{o}/
43         end
44 
45         parser.on('-f', '--format FORMATTER', 'Choose a formatter',
46                 '  [p]rogress (default - dots)',
47                 '  [d]ocumentation (group and example names)',
48                 '  [h]tml',
49                 '  [t]extmate',
50                 '  custom formatter class name') do |o|
51           options[:formatters] ||= []
52           options[:formatters] << [o]
53         end
54 
55         parser.on('-o', '--out FILE',
56                   'Write output to a file instead of STDOUT. This option applies',
57                   'to the previously specified --format, or the default format if',
58                   'no format is specified.'
59                  ) do |o|
60           options[:formatters] ||= [['progress']]
61           options[:formatters].last << o
62         end
63 
64         parser.on_tail('-h', '--help', "You're looking at it.") do
65           puts parser
66           exit
67         end
68 
69         parser.on('-I DIRECTORY', 'specify $LOAD_PATH directory (may be used more than once)') do |dir|
70           options[:libs] ||= []
71           options[:libs] << dir
72         end
73 
74         parser.on('-l', '--line_number LINE', 'Specify the line number of a single example to run') do |o|
75           options[:line_number] = o
76         end
77 
78         parser.on('-O', '--options PATH', 'Specify the path to an options file') do |path|
79           options[:custom_options_file] = path
80         end
81 
82         parser.on('-p', '--profile', 'Enable profiling of examples with output of the top 10 slowest examples') do |o|
83           options[:profile_examples] = o
84         end
85 
86         parser.on('-r', '--require PATH', 'Require a file') do |path|
87           options[:requires] ||= []
88           options[:requires] << path
89         end
90 
91         parser.on('-v', '--version', 'Show version') do
92           puts RSpec::Core::Version::STRING
93           exit
94         end
95 
96         parser.on('-X', '--drb', 'Run examples via DRb') do |o|
97           options[:drb] = true
98         end
99 
100         parser.on('--configure COMMAND', 'Generate configuration files') do |cmd|
101           CommandLineConfiguration.new(cmd).run
102           exit
103         end
104 
105         parser.on('--drb-port [PORT]', 'Port to connect to on the DRb server') do |o|
106           options[:drb_port] = o.to_i
107         end
108 
109         parser.on('--fail-fast', 'Abort the run on first failure.') do |o|
110           options[:fail_fast] = true
111         end
112 
113         parser.on('-t', '--tag TAG[:VALUE]', 'Run examples with the specified tag',
114                 'To exclude examples, add ~ before the tag (e.g. ~slow)',
115                 '(TAG is always converted to a symbol)') do |tag|
116           filter_type = tag =~ /^~/ ? :exclusion_filter : :filter
117 
118           name,value = tag.gsub(/^(~@|~|@)/, '').split(':')
119           name = name.to_sym
120           value = true if value.nil?
121 
122           options[filter_type] ||= {}
123           options[filter_type][name] = value
124         end
125 
126         parser.on('--tty', 'Used internally by rspec when sending commands to other processes') do |o|
127           options[:tty] = true
128         end
129       end
130     end
131   end
132 end

Generated on Fri Apr 22 17:22:42 -0700 2011 with rcov 0.9.8