Name | Total Lines | Lines of Code | Total Coverage | Code Coverage |
---|---|---|---|---|
rcov/ruby/1.8/gems/rspec-core-2.5.1/lib/rspec/core/command_line_configuration.rb | 62 | 50 | 32.26%
|
26.00%
|
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.
1 module RSpec |
2 module Core |
3 class CommandLineConfiguration |
4 attr_reader :command |
5 |
6 def initialize(cmd) |
7 @command = cmd |
8 end |
9 |
10 def run |
11 case @command |
12 when 'autotest' then Autotest.generate |
13 else raise ArgumentError, <<-MESSAGE |
14 |
15 #{"*"*50} |
16 "#{@command}" is not valid a valid argument to "rspec --configure". |
17 Supported options are: |
18 |
19 rspec --configure autotest # generates .rspec file |
20 |
21 #{"*"*50} |
22 MESSAGE |
23 end |
24 end |
25 |
26 class Autotest |
27 class << self |
28 def generate |
29 create_dot_rspec_file |
30 remove_autotest_dir_if_present |
31 end |
32 |
33 def create_dot_rspec_file |
34 puts "Autotest loads RSpec's Autotest subclass when there is a .rspec file in the project's root directory." |
35 if File.exist?('./.rspec') |
36 puts ".rspec file already exists, so nothing was changed." |
37 else |
38 FileUtils.touch('./.rspec') |
39 puts ".rspec file did not exist, so it was created." |
40 end |
41 end |
42 |
43 def remove_autotest_dir_if_present |
44 if discover_file_exists? |
45 print "Delete obsolete autotest/discover.rb [y/n]? " |
46 exit if gets !~ /y/i |
47 FileUtils.rm_rf(discover_file_path) |
48 end |
49 end |
50 |
51 def discover_file_exists? |
52 File.exist?(discover_file_path) |
53 end |
54 |
55 def discover_file_path |
56 File.join('autotest', 'discover.rb') |
57 end |
58 end |
59 end |
60 end |
61 end |
62 end |
Generated on Fri Apr 22 17:22:41 -0700 2011 with rcov 0.9.8