simplecov-rcov 0.1.4 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/assets/screen.css ADDED
@@ -0,0 +1,270 @@
1
+ /* @group General */
2
+
3
+ body {
4
+ font-family: Verdana, Helvetica, Arial, Sans-Serif;
5
+ font-size: 12px;
6
+ color: #4C4C4C;
7
+ background-color: #F4F2ED;
8
+ padding: 1em;
9
+ }
10
+
11
+ a:link {
12
+ color: #191919;
13
+ }
14
+
15
+ a:visited {
16
+ color: #191919;
17
+ }
18
+
19
+ pre, code {
20
+ color: #000000;
21
+ font-family: "Bitstream Vera Sans Mono","Monaco","Courier New",monospace;
22
+ font-size: 95%;
23
+ line-height: 1.3em;
24
+ margin-top: 0;
25
+ margin-bottom: 0;
26
+ padding: 0;
27
+ word-wrap: break-word;
28
+ }
29
+
30
+ h1, h2, h3, h4, h5, h6 {
31
+ margin: 0em 0em 1em 0em;
32
+ color: #666666;
33
+ }
34
+
35
+ h1 {
36
+ display: block;
37
+ font-size: 2em;
38
+ letter-spacing: -1px;
39
+ }
40
+
41
+ h2 {
42
+ margin-top: -1em;
43
+ }
44
+
45
+ fieldset {
46
+ display: inline;
47
+ border: 0px;
48
+ padding: 0px;
49
+ margin-right: 1em;
50
+ }
51
+
52
+ div.filters {
53
+ margin-bottom: 1em;
54
+ }
55
+
56
+ .hidden {
57
+ display: none;
58
+ }
59
+
60
+ /* @end */
61
+
62
+ /* @group Cross-References */
63
+
64
+ span.cross-ref-title {
65
+ font-size: 140%;
66
+ }
67
+
68
+ span.cross-ref a {
69
+ text-decoration: none;
70
+ }
71
+
72
+ span.cross-ref {
73
+ background-color:#f3f7fa;
74
+ border: 1px dashed #333;
75
+ margin: 1em;
76
+ padding: 0.5em;
77
+ overflow: hidden;
78
+ }
79
+
80
+ a.crossref-toggle {
81
+ text-decoration: none;
82
+ }
83
+
84
+ /* @end */
85
+
86
+ /* @group Report Table */
87
+
88
+ div.report_table_wrapper {
89
+ min-width: 900px;
90
+ }
91
+
92
+ table.report {
93
+ border-collapse: collapse;
94
+ border: 1px solid #666666;
95
+ width: 100%;
96
+ margin-bottom: 1em;
97
+ }
98
+
99
+ table.report tr {
100
+ line-height: 1.75em;
101
+ }
102
+
103
+ table.report th {
104
+ background: #666666;
105
+ color: #ffffff;
106
+ text-align: right;
107
+ text-transform: uppercase;
108
+ font-size: .8em;
109
+ font-weight: bold;
110
+ padding: 0em .5em;
111
+ border: 1px solid #666666;
112
+ }
113
+
114
+ table.report tfoot tr {
115
+ background: #dddddd;
116
+ font-weight: bold;
117
+ padding: .5em;
118
+ border: 1px solid #666666;
119
+ }
120
+
121
+ th.left_align, td.left_align {
122
+ text-align: left !important;
123
+ }
124
+
125
+ th.right_align, td.right_align {
126
+ text-align: right;
127
+ padding-right: 2em !important;
128
+ }
129
+
130
+ table.report th.header:hover {
131
+ cursor: pointer;
132
+ text-decoration: underline;
133
+ }
134
+
135
+ table.report th.headerSortUp:after{
136
+ content: "\25BC";
137
+ margin-left: 1em;
138
+ }
139
+
140
+ table.report th.headerSortDown:after {
141
+ content: "\25B2";
142
+ margin-left: 1em;
143
+ }
144
+
145
+ table.report tr.summary_row {
146
+ background: #cccccc;
147
+ border: 1px solid #cccccc;
148
+ }
149
+
150
+ table.report tr.summary_row td {
151
+ padding-left: .2em !important;
152
+ color: #333333;
153
+ font-weight: bold;
154
+ }
155
+
156
+ table.report td {
157
+ padding: .2em .5em .2em .5em;
158
+ }
159
+
160
+ table.report td a {
161
+ text-decoration: none;
162
+ }
163
+
164
+ table.report tbody tr:hover {
165
+ background: #cccccc !important;
166
+ }
167
+
168
+ table.report tr.summary_row td {
169
+ border-bottom: 1px solid #aaaaaa;
170
+ }
171
+
172
+ table.report tr {
173
+ background-color: #eeeeee;
174
+ }
175
+
176
+ table.report tr.odd {
177
+ background-color: #dddddd;
178
+ }
179
+
180
+ /* @end */
181
+
182
+ /* @group Percentage Graphs */
183
+
184
+ div.percent_graph_legend {
185
+ width: 5.5em;
186
+ float: left;
187
+ margin: .5em 1em .5em 0em;
188
+ height: 1em;
189
+ line-height: 1em;
190
+ }
191
+
192
+ div.percent_graph {
193
+ height: 1em;
194
+ border: #333333 1px solid;
195
+ empty-cells: show;
196
+ padding: 0px;
197
+ border-collapse: collapse;
198
+ width: 100px !important;
199
+ float: left;
200
+ margin: .5em 1em .5em 0em;
201
+ }
202
+
203
+ div.percent_graph div {
204
+ float: left;
205
+ height: 1em;
206
+ padding: 0px !important;
207
+ }
208
+
209
+ div.percent_graph div.covered {
210
+ background: #649632;
211
+ }
212
+
213
+ div.percent_graph div.uncovered {
214
+ background: #a92730;
215
+ }
216
+
217
+ div.percent_graph div.NA {
218
+ background: #eaeaea;
219
+ }
220
+
221
+ /* @end */
222
+
223
+ /* @group Details page */
224
+
225
+ table.details {
226
+ margin-top: 1em;
227
+ border-collapse: collapse;
228
+ width: 100%;
229
+ border: 1px solid #666666;
230
+ }
231
+
232
+ table.details tr {
233
+ line-height: 1.75em;
234
+ }
235
+
236
+ table.details td {
237
+ padding: .25em;
238
+ }
239
+
240
+ span.inferred, span.inferred1, span.marked, span.marked1, span.uncovered, span.uncovered1 {
241
+ display: block;
242
+ padding: .25em;
243
+ }
244
+
245
+ tr.inferred td, span.inferred {
246
+ background-color: #e0dedb;
247
+ }
248
+
249
+ tr.inferred1 td, span.inferred1 {
250
+ background-color: #e0dedb;
251
+ }
252
+
253
+ tr.marked td, span.marked, span.marked1 {
254
+ background-color: #bed2be;
255
+ }
256
+
257
+ tr.uncovered td, span.uncovered {
258
+ background-color: #ce8b8c;
259
+ }
260
+
261
+ tr.uncovered1 td, span.uncovered1 {
262
+ background-color: #ce8b8c;
263
+ }
264
+
265
+ div.key {
266
+ border: 1px solid #666666;
267
+ margin: 1em 0em;
268
+ }
269
+
270
+ /* @end */
Binary file
@@ -0,0 +1,7 @@
1
+ module SimpleCov
2
+ module Formatter
3
+ class RcovFormatter
4
+ VERSION = "0.3.0"
5
+ end
6
+ end
7
+ end
@@ -1,29 +1,67 @@
1
+ require 'erb'
2
+ require 'cgi'
3
+ require 'fileutils'
4
+ require 'time'
5
+ require 'pathname'
6
+
7
+ require File.expand_path( "#{File.dirname(__FILE__)}/simplecov-rcov/version.rb" )
8
+
9
+ unless defined?(SimpleCov)
10
+ raise RuntimeError, "simplecov-rcov is a formatter for simplecov. Please update your test helper and gemfile to require 'simplecov'!"
11
+ end
12
+
1
13
  class SimpleCov::Formatter::RcovFormatter
2
- PATH_RESULT = "/rcov/index.html"
14
+ UPSTREAM_URL = "https://github.com/fguillen/simplecov-rcov"
3
15
 
4
16
  def format( result )
17
+ Dir[File.join(File.dirname(__FILE__), '../assets/*')].each do |path|
18
+ FileUtils.cp_r(path, asset_output_path)
19
+ end
20
+
21
+ @path_relativizer = Hash.new{|h,base|
22
+ h[base] = Pathname.new(base).cleanpath.to_s.gsub(%r{^\w:[/\\]}, "").gsub(/\./, "_").gsub(/[\\\/]/, "-") + ".html"
23
+ }
24
+
25
+ generated_on = Time.now
26
+
5
27
  @files = result.files
6
28
 
7
29
  @total_lines = result.files.map { |e| e.lines.count }.inject(:+)
8
30
  @total_lines_code = result.files.map { |e| e.covered_lines.count + e.missed_lines.count }.inject(:+)
9
31
  @total_coverage = coverage(result.files)
32
+ @total_coverage_code = coverage_code(result.files)
10
33
 
11
- template = ERB.new( File.read( "#{File.dirname(__FILE__)}/../views/index.erb.html" ) )
12
- rcov_result = template.result( binding )
34
+ FileUtils.mkdir_p( SimpleCov::Formatter::RcovFormatter.output_path )
13
35
 
14
- FileUtils.mkdir_p( File.dirname( SimpleCov::Formatter::RcovFormatter.path_result ) )
36
+ write_file(template("index.html"), File.join(SimpleCov::Formatter::RcovFormatter.output_path, "/index.html") , binding)
15
37
 
16
- File.open( SimpleCov::Formatter::RcovFormatter.path_result, "w" ) do |file_result|
17
- file_result.write rcov_result
38
+ template = template("detail.html")
39
+ result.files.each do |file|
40
+ write_file(template, File.join(SimpleCov::Formatter::RcovFormatter.output_path, relative_filename(shortened_filename(file))), binding)
18
41
  end
19
42
 
20
- puts "Coverage report Rcov style generated for #{result.command_name} to #{SimpleCov::Formatter::RcovFormatter.path_result}"
21
-
22
- return rcov_result
43
+ puts "Coverage report Rcov style generated for #{result.command_name} to #{SimpleCov::Formatter::RcovFormatter.output_path}"
23
44
  end
24
45
 
25
46
  private
26
47
 
48
+ def write_file(template, output_filename, binding)
49
+ rcov_result = template.result( binding )
50
+
51
+ File.open( output_filename, "w" ) do |file_result|
52
+ file_result.write rcov_result
53
+ end
54
+ end
55
+
56
+ def template(name)
57
+ ERB.new(File.read(File.join(File.dirname(__FILE__), '../views/', "#{name}.erb")), nil, '-')
58
+ end
59
+
60
+ def lines(file_list)
61
+ return 0.0 if file_list.length == 0
62
+ file_list.map { |e| e.lines.count }.inject(:+)
63
+ end
64
+
27
65
  def lines_covered(file_list)
28
66
  return 0.0 if file_list.length == 0
29
67
  file_list.map {|f| f.covered_lines.count }.inject(&:+)
@@ -40,12 +78,75 @@ class SimpleCov::Formatter::RcovFormatter
40
78
 
41
79
  def coverage(file_list)
42
80
  return 100.0 if file_list.length == 0 or lines_of_code(file_list) == 0
43
- lines_missed = file_list.map {|f| f.missed_lines.count }.inject(&:+)
81
+ never_lines = file_list.map {|f| f.never_lines.count }.inject(&:+)
82
+
83
+ (lines_covered(file_list) + never_lines) * 100 / lines(file_list).to_f
84
+ end
85
+
86
+ def coverage_code(file_list)
87
+ return 100.0 if file_list.length == 0 or lines_of_code(file_list) == 0
44
88
 
45
89
  lines_covered(file_list) * 100 / lines_of_code(file_list).to_f
46
90
  end
47
91
 
48
- def self.path_result
49
- File.join( SimpleCov.coverage_path, SimpleCov::Formatter::RcovFormatter::PATH_RESULT )
92
+ def self.output_path
93
+ File.join( SimpleCov.coverage_path, "/rcov" )
94
+ end
95
+
96
+ def asset_output_path
97
+ return @asset_output_path if @asset_output_path
98
+ @asset_output_path = File.join(SimpleCov::Formatter::RcovFormatter.output_path, 'assets', SimpleCov::Formatter::RcovFormatter::VERSION)
99
+ FileUtils.mkdir_p(@asset_output_path)
100
+ @asset_output_path
101
+ end
102
+
103
+ def project_name
104
+ SimpleCov.project_name
105
+ end
106
+
107
+ def assets_path(name)
108
+ File.join('./assets', SimpleCov::Formatter::RcovFormatter::VERSION, name)
109
+ end
110
+
111
+ def code_coverage_html(code_coverage_percentage, is_total=false)
112
+ %{<div class="percent_graph_legend"><tt class='#{ is_total ? 'coverage_total' : ''}'>#{ "%3.2f" % code_coverage_percentage }%</tt></div>
113
+ <div class="percent_graph">
114
+ <div class="covered" style="width:#{ code_coverage_percentage.round }px"></div>
115
+ <div class="uncovered" style="width:#{ 100 - code_coverage_percentage.round }px"></div>
116
+ </div>}
117
+ end
118
+
119
+ def total_coverage_for_report(file)
120
+ return 100.0 if file.lines.count == 0
121
+ (file.covered_lines.count + file.never_lines.count) * 100 / file.lines.count.to_f
122
+ end
123
+
124
+ def coverage_threshold_classes(percentage)
125
+ return 110 if percentage == 100
126
+ return (1..10).find_all{|i| i * 10 > percentage}.map{|i| i.to_i * 10} * " "
127
+ end
128
+
129
+ def shortened_filename(file)
130
+ file.filename.gsub("#{SimpleCov.root}/", '')
131
+ end
132
+
133
+ def relative_filename(path)
134
+ @path_relativizer[path]
135
+ end
136
+
137
+ def file_filter_classes(file_path)
138
+ file_path.split('/')[0..-2] * " "
139
+ end
140
+
141
+ def line_css_for(coverage)
142
+ unless coverage.nil?
143
+ if coverage > 0
144
+ "marked"
145
+ else
146
+ "uncovered"
147
+ end
148
+ else
149
+ "inferred"
150
+ end
50
151
  end
51
152
  end
@@ -1,40 +1,27 @@
1
1
  # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require 'simplecov-rcov/version'
2
4
 
3
5
  Gem::Specification.new do |s|
4
- s.name = %q{simplecov-rcov}
5
- s.version = "0.1.4"
6
+ s.name = %q{simplecov-rcov}
7
+ s.version = SimpleCov::Formatter::RcovFormatter::VERSION
8
+ s.platform = Gem::Platform::RUBY
9
+ s.authors = ["Fernando Guillen http://fernandoguillen.info", "Wes Morgan http://github.com/cap10morgan", "Wandenberg Peixoto http://github.com/wandenberg"]
10
+ s.email = ["fguillen.mail@gmail.com", "cap10morgan@gmail.com"]
11
+ s.homepage = "http://github.com/fguillen/simplecov-rcov"
12
+ s.summary = "Rcov style formatter for SimpleCov"
13
+ s.description = "Rcov style formatter for SimpleCov"
6
14
 
7
- s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
- s.authors = ["Fernando Guillen http://fernandoguillen.info, Wes Morgan http://github.com/cap10morgan"]
9
- s.date = %q{2011-02-10}
10
- s.description = %q{Rcov style formatter for SimpleCov}
11
- s.email = ["fguillen.mail@gmail.com", "cap10morgan@gmail.com"]
12
- s.extra_rdoc_files = ["README.md", "lib/simplecov-rcov.rb"]
13
- s.files = ["Gemfile", "Gemfile.lock", "Manifest", "README.md", "Rakefile", "lib/simplecov-rcov.rb", "simplecov-rcov.gemspec", "test/fixtures/app/controllers/sample.rb", "test/fixtures/app/models/airplane.rb", "test/fixtures/app/models/dog.rb", "test/fixtures/app/models/house.rb", "test/fixtures/app/models/robot.rb", "test/fixtures/app/models/user.rb", "test/fixtures/file_tr.html", "test/fixtures/sample.rb", "test/fixtures/totals_tr.html", "test/helper.rb", "test/simplecov-rcov_test.rb", "views/index.erb.html"]
14
- s.homepage = %q{http://github.com/fguillen/simplecov-rcov}
15
- s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Simplecov-rcov", "--main", "README.md"]
15
+ s.rubyforge_project = "simplecov-rcov"
16
+
17
+ s.files = `git ls-files`.split("\n")
18
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
19
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
16
20
  s.require_paths = ["lib"]
17
- s.rubyforge_project = %q{simplecov-rcov}
18
- s.rubygems_version = %q{1.3.7}
19
- s.summary = %q{Rcov style formatter for SimpleCov}
20
- s.test_files = ["test/simplecov-rcov_test.rb"]
21
21
 
22
- if s.respond_to? :specification_version then
23
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
24
- s.specification_version = 3
22
+ s.add_dependency 'simplecov', '>= 0.4.1'
25
23
 
26
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
27
- s.add_runtime_dependency(%q<simplecov>, [">= 0"])
28
- s.add_development_dependency(%q<echoe>, [">= 0"])
29
- s.add_development_dependency(%q<mocha>, [">= 0"])
30
- else
31
- s.add_dependency(%q<simplecov>, [">= 0"])
32
- s.add_dependency(%q<echoe>, [">= 0"])
33
- s.add_dependency(%q<mocha>, [">= 0"])
34
- end
35
- else
36
- s.add_dependency(%q<simplecov>, [">= 0"])
37
- s.add_dependency(%q<echoe>, [">= 0"])
38
- s.add_dependency(%q<mocha>, [">= 0"])
39
- end
24
+ s.add_development_dependency 'bundler', '>= 1.0.0.rc.6'
25
+ s.add_development_dependency 'mocha'
26
+ s.add_development_dependency 'rake', '>=12.3.3'
40
27
  end
@@ -0,0 +1,30 @@
1
+ <tr class="inferred">
2
+ <td><pre><a name="line2">2</a> # Foo class</pre></td>
3
+ </tr>
4
+ <tr class="marked">
5
+ <td><pre><a name="line3">3</a> class Foo</pre></td>
6
+ </tr>
7
+ <tr class="marked">
8
+ <td><pre><a name="line4">4</a> def initialize</pre></td>
9
+ </tr>
10
+ <tr class="marked">
11
+ <td><pre><a name="line5">5</a> @foo = 'baz'</pre></td>
12
+ </tr>
13
+ <tr class="marked">
14
+ <td><pre><a name="line6">6</a> end</pre></td>
15
+ </tr>
16
+ <tr class="uncovered">
17
+ <td><pre><a name="line7">7</a> </pre></td>
18
+ </tr>
19
+ <tr class="marked">
20
+ <td><pre><a name="line8">8</a> def bar</pre></td>
21
+ </tr>
22
+ <tr class="uncovered">
23
+ <td><pre><a name="line9">9</a> @foo</pre></td>
24
+ </tr>
25
+ <tr class="inferred">
26
+ <td><pre><a name="line10">10</a> end</pre></td>
27
+ </tr>
28
+ <tr class="inferred">
29
+ <td><pre><a name="line11">11</a> end</pre></td>
30
+ </tr>
@@ -1,7 +1,15 @@
1
- <tr class="all_files">
2
- <td class="left_align"><a href="#./test/fixtures/app/models/user.rb">./test/fixtures/app/models/user.rb</a></td>
1
+ <tr class="all_files all_coverage 80 90 100 test fixtures app models odd">
2
+ <td class="left_align"><a href="test-fixtures-app-models-user_rb.html">test/fixtures/app/models/user.rb</a></td>
3
3
  <td class='right_align'><tt>10</tt></td>
4
4
  <td class='right_align'><tt>7</tt></td>
5
- <td class="left_align"><tt class=''>71.43%</tt></td>
6
- <td class="left_align"><tt class=''>71.43%</tt></td>
5
+ <td class="left_align"><div class="percent_graph_legend"><tt class=''>80.00%</tt></div>
6
+ <div class="percent_graph">
7
+ <div class="covered" style="width:80px"></div>
8
+ <div class="uncovered" style="width:20px"></div>
9
+ </div></td>
10
+ <td class="left_align"><div class="percent_graph_legend"><tt class=''>71.43%</tt></div>
11
+ <div class="percent_graph">
12
+ <div class="covered" style="width:71px"></div>
13
+ <div class="uncovered" style="width:29px"></div>
14
+ </div></td>
7
15
  </tr>
@@ -2,6 +2,14 @@
2
2
  <td class="left_align">TOTAL</td>
3
3
  <td class='right_align'><tt>60</tt></td>
4
4
  <td class='right_align'><tt>34</tt></td>
5
- <td class="left_align"><tt class=''>67.65%</tt></td>
6
- <td class="left_align"><tt class='coverage_total'>67.65%</tt></td>
5
+ <td class="left_align"><div class="percent_graph_legend"><tt class=''>81.67%</tt></div>
6
+ <div class="percent_graph">
7
+ <div class="covered" style="width:82px"></div>
8
+ <div class="uncovered" style="width:18px"></div>
9
+ </div></td>
10
+ <td class="left_align"><div class="percent_graph_legend"><tt class='coverage_total'>67.65%</tt></div>
11
+ <div class="percent_graph">
12
+ <div class="covered" style="width:68px"></div>
13
+ <div class="uncovered" style="width:32px"></div>
14
+ </div></td>
7
15
  </tr>
@@ -0,0 +1,45 @@
1
+ require File.expand_path( "#{File.dirname(__FILE__)}/helper" )
2
+
3
+ class SimplecovRcovFormatterTest < Test::Unit::TestCase
4
+ def test_format
5
+ SimpleCov.stubs(:coverage_path).returns('/tmp')
6
+ index = File.join( SimpleCov::Formatter::RcovFormatter.output_path, "/index.html")
7
+ if File.exists?( index )
8
+ File.delete( index )
9
+ end
10
+
11
+ @original_result = {
12
+ source_fixture( 'sample.rb' ) => [nil, 1, 1, 1, nil, 0, 1, 1, nil, nil],
13
+ source_fixture( 'app/models/user.rb' ) => [nil, 1, 1, 1, 1, 0, 1, 0, nil, nil],
14
+ source_fixture( 'app/models/robot.rb' ) => [1, 1, 1, 1, nil, nil, 1, 0, nil, nil],
15
+ source_fixture( 'app/models/house.rb' ) => [nil, nil, nil, nil, nil, nil, nil, nil, nil, nil],
16
+ source_fixture( 'app/models/airplane.rb' ) => [0, 0, 0, 0, 0],
17
+ source_fixture( 'app/models/dog.rb' ) => [1, 1, 1, 1, 1],
18
+ source_fixture( 'app/controllers/sample.rb' ) => [nil, 1, 1, 1, nil, nil, 0, 0, nil, nil]
19
+ }
20
+
21
+ @result = SimpleCov::Result.new( @original_result )
22
+ SimpleCov::Formatter::RcovFormatter.new().format( @result )
23
+
24
+ assert( File.exists?( index ) )
25
+
26
+ rcov_result = File.read( index )
27
+ assert_match( File.read( "#{File.dirname(__FILE__)}/fixtures/totals_tr.html"), rcov_result )
28
+ assert_match( File.read( "#{File.dirname(__FILE__)}/fixtures/file_tr.html"), rcov_result )
29
+
30
+ assert( File.exists?( File.join( SimpleCov::Formatter::RcovFormatter.output_path, "/test-fixtures-sample_rb.html") ) )
31
+ assert( File.exists?( File.join( SimpleCov::Formatter::RcovFormatter.output_path, "/test-fixtures-app-models-user_rb.html") ) )
32
+ assert( File.exists?( File.join( SimpleCov::Formatter::RcovFormatter.output_path, "/test-fixtures-app-models-robot_rb.html") ) )
33
+ assert( File.exists?( File.join( SimpleCov::Formatter::RcovFormatter.output_path, "/test-fixtures-app-models-house_rb.html") ) )
34
+ assert( File.exists?( File.join( SimpleCov::Formatter::RcovFormatter.output_path, "/test-fixtures-app-models-airplane_rb.html") ) )
35
+ assert( File.exists?( File.join( SimpleCov::Formatter::RcovFormatter.output_path, "/test-fixtures-app-models-dog_rb.html") ) )
36
+ assert( File.exists?( File.join( SimpleCov::Formatter::RcovFormatter.output_path, "/test-fixtures-app-controllers-sample_rb.html") ) )
37
+
38
+ assert_match( File.read( "#{File.dirname(__FILE__)}/fixtures/detail_trs.html"), File.read(File.join( SimpleCov::Formatter::RcovFormatter.output_path, "/test-fixtures-app-models-user_rb.html")) )
39
+
40
+ end
41
+
42
+ def source_fixture( filename )
43
+ File.expand_path( File.join( File.dirname( __FILE__ ), 'fixtures', filename ) )
44
+ end
45
+ end
@@ -0,0 +1,56 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
+ <html lang='en' xml:lang='en' xmlns='http://www.w3.org/1999/xhtml'>
3
+ <head>
4
+ <title><%= shortened_filename(file) %></title>
5
+ <link href="<%= assets_path('screen.css')%>" media="all" rel="stylesheet" type="text/css" />
6
+ <link href="<%= assets_path('print.css')%>" media="print" rel="stylesheet" type="text/css" />
7
+ <meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
8
+ <script type="text/javascript" src="<%= assets_path('rcov.js')%>"></script>
9
+ </head>
10
+ <body>
11
+ <h1><%= "#{project_name} C0 Coverage Information - Simploco - RCov" %></h1>
12
+ <h2><%= shortened_filename(file) %></h2>
13
+
14
+ <div class="report_table_wrapper">
15
+ <table class='report' id='report_table'>
16
+ <thead>
17
+ <tr>
18
+ <th class="left_align">Name</th>
19
+ <th class="right_align">Total Lines</th>
20
+ <th class="right_align">Lines of Code</th>
21
+ <th class="left_align">Total Coverage</th>
22
+ <th class="left_align">Code Coverage</th>
23
+ </tr>
24
+ </thead>
25
+ <tbody>
26
+ <tr>
27
+ <td class="left_align"><a href="<%= relative_filename(shortened_filename(file)) %>"><%= shortened_filename(file) %></a></td>
28
+ <td class='right_align'><tt><%= file.lines.count %></tt></td>
29
+ <td class='right_align'><tt><%= file.covered_lines.count + file.missed_lines.count %></tt></td>
30
+ <td class="left_align"><%= code_coverage_html(total_coverage_for_report(file)) %></td>
31
+ <td class="left_align"><%= code_coverage_html(file.covered_percent) %></td>
32
+ </tr>
33
+ </tbody>
34
+ </table>
35
+ </div>
36
+
37
+ <h3>Key</h3>
38
+
39
+ <div class="key"><pre><span class='marked'>Code reported as executed by Ruby looks like this...</span><span class='marked1'>and this: this line is also marked as covered.</span><span class='inferred'>Lines considered as run by rcov, but not reported by Ruby, look like this,</span><span class='inferred1'>and this: these lines were inferred by rcov (using simple heuristics).</span><span class='uncovered'>Finally, here's a line marked as not executed.</span></pre></div>
40
+
41
+ <h3>Coverage Details</h3>
42
+
43
+ <table class="details">
44
+ <tbody>
45
+ <%- file.lines.each do |line| -%>
46
+ <tr class="<%= line_css_for(line.coverage) %>">
47
+ <td><pre><a name="line<%= line.number.next %>"><%= line.number.next %></a> <%= CGI::escapeHTML(line.src.chomp) %></pre></td>
48
+ </tr>
49
+ <%- end -%>
50
+ </tbody>
51
+ </table>
52
+
53
+ <p>Generated on <%= generated_on %> with <a href="<%= SimpleCov::Formatter::RcovFormatter::UPSTREAM_URL %>">SimpleCov-RCov <%= SimpleCov::Formatter::RcovFormatter::VERSION %></a></p>
54
+
55
+ </body>
56
+ </html>