simplecov-reports 0.0.4.ooyala

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. checksums.yaml +15 -0
  2. data/.gitignore +18 -0
  3. data/Gemfile +7 -0
  4. data/LICENSE.txt +22 -0
  5. data/README.md +66 -0
  6. data/Rakefile +73 -0
  7. data/lib/simplecov-html-extended.rb +50 -0
  8. data/lib/simplecov/configuration.rb +98 -0
  9. data/lib/simplecov/reports.rb +5 -0
  10. data/lib/simplecov/reports/author_report.rb +180 -0
  11. data/lib/simplecov/reports/file_report.rb +97 -0
  12. data/lib/simplecov/reports/version.rb +5 -0
  13. data/lib/simplecov/source_file.rb +39 -0
  14. data/simplecov-reports.gemspec +29 -0
  15. data/test/fixtures/author_report/author_stats_file1.rb +23 -0
  16. data/test/fixtures/author_report/author_stats_file2.rb +26 -0
  17. data/test/fixtures/author_report/best_author_tolerance.rb +264 -0
  18. data/test/fixtures/file_report/classes_covered.rb +80 -0
  19. data/test/fixtures/file_report/classes_not_covered.rb +37 -0
  20. data/test/fixtures/file_report/classes_partially_covered.rb +11 -0
  21. data/test/fixtures/file_report/methods_covered.rb +38 -0
  22. data/test/fixtures/file_report/methods_not_covered.rb +39 -0
  23. data/test/fixtures/file_report/methods_partially_covered.rb +13 -0
  24. data/test/fixtures/line enhancer/line_enhancer_fixture.rb +1 -0
  25. data/test/helper.rb +19 -0
  26. data/test/memory_measure.rb +0 -0
  27. data/test/test_all_reports.rb +35 -0
  28. data/test/test_author_stats.rb +89 -0
  29. data/test/test_best_author_stage1.rb +75 -0
  30. data/test/test_best_author_stage2.rb +75 -0
  31. data/test/test_best_author_stage3.rb +86 -0
  32. data/test/test_best_author_stage4.rb +97 -0
  33. data/test/test_best_author_stage5.rb +97 -0
  34. data/test/test_file_reports.rb +159 -0
  35. data/test/test_html_reports.rb +43 -0
  36. data/test/test_line_enhancer.rb +26 -0
  37. data/views/author_report.erb +37 -0
  38. data/views/file_report.erb +21 -0
  39. metadata +203 -0
@@ -0,0 +1,75 @@
1
+ require_relative 'helper'
2
+
3
+ SimpleCov.start do
4
+ use_merging true
5
+ merge_timeout 3600
6
+
7
+ add_report(:type => SimpleCov::Configuration::ReportTypes::Author,
8
+ :sub_types => [
9
+ SimpleCov::Configuration::ReportTypes::Author::BestAuthor
10
+ ],
11
+ :best_authors_count => 2)
12
+ end
13
+
14
+ # Execute code to get coverage
15
+ COVERAGE = "cover"
16
+ require_relative "fixtures/author_report/best_author_tolerance"
17
+
18
+ # best_author_tolerance is 50%
19
+ # best_author_cutoff is 15%
20
+ # best_author_count is 3
21
+ # Author: Rajesh Konda has 10% coverage with 100 lines of code
22
+ # Author: AuthorTesterOne has 20% coverage with 70 lines of code
23
+ # Author: AuthorTesterTwo has 30% coverage with 30 lines of code
24
+ # Author: AuthorTesterThree has 40% coverage with 30 lines of code
25
+ # Author: AuthorTesterFour has 50% coverage with 10 lines of code
26
+
27
+
28
+ class TestBestAuthorReport < Test::Unit::TestCase
29
+ context "author report" do
30
+ context "/best author report" do
31
+ setup do
32
+ @result = SimpleCov.result.format!
33
+ @author_reports = @result.reports[0][:sub_reports]
34
+ end
35
+
36
+ context " when :best_authors_count=2" do
37
+ should "exist" do
38
+ assert_equal 1, @author_reports.count, "best author report should be the only report"
39
+ end
40
+
41
+ should "have authors in right order" do
42
+ authors = @author_reports[0][:items].keys
43
+ expected_authors = ["AuthorTesterOne", "Rajesh Konda"]
44
+ assert_equal expected_authors, authors, "Authors should be the expected ones"
45
+ end
46
+
47
+ should "match files reported per author" do
48
+ files = @author_reports[0][:items]["Rajesh Konda"][:files].keys.map(&:filename).
49
+ collect{ |item| item.slice(/simplecov-reports(.*)/, 1) }
50
+ expected_files = ["/test/fixtures/author_report/best_author_tolerance.rb"]
51
+
52
+ assert_equal expected_files, files,
53
+ "Rajesh Konda's authored files don't match"
54
+
55
+ files = @author_reports[0][:items]["AuthorTesterOne"][:files].keys.map(&:filename).
56
+ collect{ |item| item.slice(/simplecov-reports(.*)/, 1) }
57
+ expected_files = ["/test/fixtures/author_report/best_author_tolerance.rb"]
58
+
59
+ assert_equal expected_files, files,
60
+ "AuthorTesterOne's authored files don't match"
61
+ end
62
+
63
+ should "match the coverage report per author per file" do
64
+ author_report = @author_reports[0][:items]["Rajesh Konda"][:files].values
65
+ expected_author_report = [{:covered=>10, :missed=>90, :total=>100, :coverage=>10.0}]
66
+ assert_equal expected_author_report, author_report, "Rajesh Konda's author report should match"
67
+
68
+ author_report = @author_reports[0][:items]["AuthorTesterOne"][:files].values
69
+ expected_author_report = [{:covered=>14, :missed=>56, :total=>70, :coverage=>20.0}]
70
+ assert_equal expected_author_report, author_report, "AuthorTesterOne's author report should match"
71
+ end
72
+ end
73
+ end # context "/best author report" do
74
+ end # context "author report" do
75
+ end # class TestAuthorReports
@@ -0,0 +1,86 @@
1
+ require_relative 'helper'
2
+
3
+ SimpleCov.start do
4
+ use_merging true
5
+ merge_timeout 3600
6
+
7
+ add_report(:type => SimpleCov::Configuration::ReportTypes::Author,
8
+ :sub_types => [
9
+ SimpleCov::Configuration::ReportTypes::Author::BestAuthor
10
+ ],
11
+ :best_authors_count => 3)
12
+ end
13
+
14
+ # Execute code to get coverage
15
+ COVERAGE = "cover"
16
+ require_relative "fixtures/author_report/best_author_tolerance"
17
+
18
+ # best_author_tolerance is 50%
19
+ # best_author_cutoff is 15%
20
+ # best_author_count is 3
21
+ # Author: Rajesh Konda has 10% coverage with 100 lines of code
22
+ # Author: AuthorTesterOne has 20% coverage with 70 lines of code
23
+ # Author: AuthorTesterTwo has 30% coverage with 30 lines of code
24
+ # Author: AuthorTesterThree has 40% coverage with 30 lines of code
25
+ # Author: AuthorTesterFour has 50% coverage with 10 lines of code
26
+
27
+
28
+ class TestBestAuthorReport < Test::Unit::TestCase
29
+ context "author report" do
30
+ context "/best author report" do
31
+ setup do
32
+ @result = SimpleCov.result.format!
33
+ @author_reports = @result.reports[0][:sub_reports]
34
+ end
35
+
36
+ context " when :best_authors_count=3" do
37
+ should "exist" do
38
+ assert_equal 1, @author_reports.count, "best author report should be the only report"
39
+ end
40
+
41
+ should "have authors in right order" do
42
+ authors = @author_reports[0][:items].keys
43
+ expected_authors = ["AuthorTesterTwo", "AuthorTesterOne", "Rajesh Konda"]
44
+ assert_equal expected_authors, authors, "Authors should be the expected ones"
45
+ end
46
+
47
+ should "match files reported per author" do
48
+ files = @author_reports[0][:items]["Rajesh Konda"][:files].keys.map(&:filename).
49
+ collect{ |item| item.slice(/simplecov-reports(.*)/, 1) }
50
+ expected_files = ["/test/fixtures/author_report/best_author_tolerance.rb"]
51
+
52
+ assert_equal expected_files, files,
53
+ "Rajesh Konda's authored files don't match"
54
+
55
+ files = @author_reports[0][:items]["AuthorTesterOne"][:files].keys.map(&:filename).
56
+ collect{ |item| item.slice(/simplecov-reports(.*)/, 1) }
57
+ expected_files = ["/test/fixtures/author_report/best_author_tolerance.rb"]
58
+
59
+ assert_equal expected_files, files,
60
+ "AuthorTesterOne's authored files don't match"
61
+
62
+ files = @author_reports[0][:items]["AuthorTesterTwo"][:files].keys.map(&:filename).
63
+ collect{ |item| item.slice(/simplecov-reports(.*)/, 1) }
64
+ expected_files = ["/test/fixtures/author_report/best_author_tolerance.rb"]
65
+
66
+ assert_equal expected_files, files,
67
+ "AuthorTesterTwo's authored files don't match"
68
+ end
69
+
70
+ should "match the coverage report per author per file" do
71
+ author_report = @author_reports[0][:items]["Rajesh Konda"][:files].values
72
+ expected_author_report = [{:covered=>10, :missed=>90, :total=>100, :coverage=>10.0}]
73
+ assert_equal expected_author_report, author_report, "Rajesh Konda's author report should match"
74
+
75
+ author_report = @author_reports[0][:items]["AuthorTesterOne"][:files].values
76
+ expected_author_report = [{:covered=>14, :missed=>56, :total=>70, :coverage=>20.0}]
77
+ assert_equal expected_author_report, author_report, "AuthorTesterOne's author report should match"
78
+
79
+ author_report = @author_reports[0][:items]["AuthorTesterTwo"][:files].values
80
+ expected_author_report = [{:covered=>9, :missed=>21, :total=>30, :coverage=>30.0}]
81
+ assert_equal expected_author_report, author_report, "AuthorTesterTwo's author report should match"
82
+ end
83
+ end
84
+ end # context "/best author report" do
85
+ end # context "author report" do
86
+ end # class TestAuthorReports
@@ -0,0 +1,97 @@
1
+ require_relative 'helper'
2
+
3
+ SimpleCov.start do
4
+ use_merging true
5
+ merge_timeout 3600
6
+
7
+ add_report(:type => SimpleCov::Configuration::ReportTypes::Author,
8
+ :sub_types => [
9
+ SimpleCov::Configuration::ReportTypes::Author::BestAuthor
10
+ ],
11
+ :best_authors_count => 4)
12
+ end
13
+
14
+ # Execute code to get coverage
15
+ COVERAGE = "cover"
16
+ require_relative "fixtures/author_report/best_author_tolerance"
17
+
18
+ # best_author_tolerance is 50%
19
+ # best_author_cutoff is 15%
20
+ # best_author_count is 3
21
+ # Author: Rajesh Konda has 10% coverage with 100 lines of code
22
+ # Author: AuthorTesterOne has 20% coverage with 70 lines of code
23
+ # Author: AuthorTesterTwo has 30% coverage with 30 lines of code
24
+ # Author: AuthorTesterThree has 40% coverage with 30 lines of code
25
+ # Author: AuthorTesterFour has 50% coverage with 10 lines of code
26
+
27
+
28
+ class TestBestAuthorReport < Test::Unit::TestCase
29
+ context "author report" do
30
+ context "/best author report" do
31
+ setup do
32
+ @result = SimpleCov.result.format!
33
+ @author_reports = @result.reports[0][:sub_reports]
34
+ end
35
+
36
+ context " when :best_authors_count=4" do
37
+ should "exist" do
38
+ assert_equal 1, @author_reports.count, "best author report should be the only report"
39
+ end
40
+
41
+ should "have authors in right order" do
42
+ authors = @author_reports[0][:items].keys
43
+ expected_authors = ["AuthorTesterThree", "AuthorTesterTwo", "AuthorTesterOne", "Rajesh Konda"]
44
+ assert_equal expected_authors, authors, "Authors should be the expected ones"
45
+ end
46
+
47
+ should "match files reported per author" do
48
+ files = @author_reports[0][:items]["Rajesh Konda"][:files].keys.map(&:filename).
49
+ collect{ |item| item.slice(/simplecov-reports(.*)/, 1) }
50
+ expected_files = ["/test/fixtures/author_report/best_author_tolerance.rb"]
51
+
52
+ assert_equal expected_files, files,
53
+ "Rajesh Konda's authored files don't match"
54
+
55
+ files = @author_reports[0][:items]["AuthorTesterOne"][:files].keys.map(&:filename).
56
+ collect{ |item| item.slice(/simplecov-reports(.*)/, 1) }
57
+ expected_files = ["/test/fixtures/author_report/best_author_tolerance.rb"]
58
+
59
+ assert_equal expected_files, files,
60
+ "AuthorTesterOne's authored files don't match"
61
+
62
+ files = @author_reports[0][:items]["AuthorTesterTwo"][:files].keys.map(&:filename).
63
+ collect{ |item| item.slice(/simplecov-reports(.*)/, 1) }
64
+ expected_files = ["/test/fixtures/author_report/best_author_tolerance.rb"]
65
+
66
+ assert_equal expected_files, files,
67
+ "AuthorTesterTwo's authored files don't match"
68
+
69
+ files = @author_reports[0][:items]["AuthorTesterThree"][:files].keys.map(&:filename).
70
+ collect{ |item| item.slice(/simplecov-reports(.*)/, 1) }
71
+ expected_files = ["/test/fixtures/author_report/best_author_tolerance.rb"]
72
+
73
+ assert_equal expected_files, files,
74
+ "AuthorTesterThree's authored files don't match"
75
+ end
76
+
77
+ should "match the coverage report per author per file" do
78
+ author_report = @author_reports[0][:items]["Rajesh Konda"][:files].values
79
+ expected_author_report = [{:covered=>10, :missed=>90, :total=>100, :coverage=>10.0}]
80
+ assert_equal expected_author_report, author_report, "Rajesh Konda's author report should match"
81
+
82
+ author_report = @author_reports[0][:items]["AuthorTesterOne"][:files].values
83
+ expected_author_report = [{:covered=>14, :missed=>56, :total=>70, :coverage=>20.0}]
84
+ assert_equal expected_author_report, author_report, "AuthorTesterOne's author report should match"
85
+
86
+ author_report = @author_reports[0][:items]["AuthorTesterTwo"][:files].values
87
+ expected_author_report = [{:covered=>9, :missed=>21, :total=>30, :coverage=>30.0}]
88
+ assert_equal expected_author_report, author_report, "AuthorTesterTwo's author report should match"
89
+
90
+ author_report = @author_reports[0][:items]["AuthorTesterThree"][:files].values
91
+ expected_author_report = [{:covered=>12, :missed=>18, :total=>30, :coverage=>40.0}]
92
+ assert_equal expected_author_report, author_report, "AuthorTesterThree's author report should match"
93
+ end
94
+ end
95
+ end # context "/best author report" do
96
+ end # context "author report" do
97
+ end # class TestAuthorReports
@@ -0,0 +1,97 @@
1
+ require_relative 'helper'
2
+
3
+ SimpleCov.start do
4
+ use_merging true
5
+ merge_timeout 3600
6
+
7
+ add_report(:type => SimpleCov::Configuration::ReportTypes::Author,
8
+ :sub_types => [
9
+ SimpleCov::Configuration::ReportTypes::Author::BestAuthor
10
+ ],
11
+ :best_authors_count => 5)
12
+ end
13
+
14
+ # Execute code to get coverage
15
+ COVERAGE = "cover"
16
+ require_relative "fixtures/author_report/best_author_tolerance"
17
+
18
+ # best_author_tolerance is 50%
19
+ # best_author_cutoff is 15%
20
+ # best_author_count is 3
21
+ # Author: Rajesh Konda has 10% coverage with 100 lines of code
22
+ # Author: AuthorTesterOne has 20% coverage with 70 lines of code
23
+ # Author: AuthorTesterTwo has 30% coverage with 30 lines of code
24
+ # Author: AuthorTesterThree has 40% coverage with 30 lines of code
25
+ # Author: AuthorTesterFour has 50% coverage with 10 lines of code
26
+
27
+
28
+ class TestBestAuthorReport < Test::Unit::TestCase
29
+ context "author report" do
30
+ context "/best author report" do
31
+ setup do
32
+ @result = SimpleCov.result.format!
33
+ @author_reports = @result.reports[0][:sub_reports]
34
+ end
35
+
36
+ context " when :best_authors_count=5" do
37
+ should "exist" do
38
+ assert_equal 1, @author_reports.count, "best author report should be the only report"
39
+ end
40
+
41
+ should "have authors in right order" do
42
+ authors = @author_reports[0][:items].keys
43
+ expected_authors = ["AuthorTesterThree", "AuthorTesterTwo", "AuthorTesterOne", "Rajesh Konda"]
44
+ assert_equal expected_authors, authors, "Authors should be the expected ones"
45
+ end
46
+
47
+ should "match files reported per author" do
48
+ files = @author_reports[0][:items]["Rajesh Konda"][:files].keys.map(&:filename).
49
+ collect{ |item| item.slice(/simplecov-reports(.*)/, 1) }
50
+ expected_files = ["/test/fixtures/author_report/best_author_tolerance.rb"]
51
+
52
+ assert_equal expected_files, files,
53
+ "Rajesh Konda's authored files don't match"
54
+
55
+ files = @author_reports[0][:items]["AuthorTesterOne"][:files].keys.map(&:filename).
56
+ collect{ |item| item.slice(/simplecov-reports(.*)/, 1) }
57
+ expected_files = ["/test/fixtures/author_report/best_author_tolerance.rb"]
58
+
59
+ assert_equal expected_files, files,
60
+ "AuthorTesterOne's authored files don't match"
61
+
62
+ files = @author_reports[0][:items]["AuthorTesterTwo"][:files].keys.map(&:filename).
63
+ collect{ |item| item.slice(/simplecov-reports(.*)/, 1) }
64
+ expected_files = ["/test/fixtures/author_report/best_author_tolerance.rb"]
65
+
66
+ assert_equal expected_files, files,
67
+ "AuthorTesterTwo's authored files don't match"
68
+
69
+ files = @author_reports[0][:items]["AuthorTesterThree"][:files].keys.map(&:filename).
70
+ collect{ |item| item.slice(/simplecov-reports(.*)/, 1) }
71
+ expected_files = ["/test/fixtures/author_report/best_author_tolerance.rb"]
72
+
73
+ assert_equal expected_files, files,
74
+ "AuthorTesterThree's authored files don't match"
75
+ end
76
+
77
+ should "match the coverage report per author per file" do
78
+ author_report = @author_reports[0][:items]["Rajesh Konda"][:files].values
79
+ expected_author_report = [{:covered=>10, :missed=>90, :total=>100, :coverage=>10.0}]
80
+ assert_equal expected_author_report, author_report, "Rajesh Konda's author report should match"
81
+
82
+ author_report = @author_reports[0][:items]["AuthorTesterOne"][:files].values
83
+ expected_author_report = [{:covered=>14, :missed=>56, :total=>70, :coverage=>20.0}]
84
+ assert_equal expected_author_report, author_report, "AuthorTesterOne's author report should match"
85
+
86
+ author_report = @author_reports[0][:items]["AuthorTesterTwo"][:files].values
87
+ expected_author_report = [{:covered=>9, :missed=>21, :total=>30, :coverage=>30.0}]
88
+ assert_equal expected_author_report, author_report, "AuthorTesterTwo's author report should match"
89
+
90
+ author_report = @author_reports[0][:items]["AuthorTesterThree"][:files].values
91
+ expected_author_report = [{:covered=>12, :missed=>18, :total=>30, :coverage=>40.0}]
92
+ assert_equal expected_author_report, author_report, "AuthorTesterThree's author report should match"
93
+ end
94
+ end
95
+ end # context "/best author report" do
96
+ end # context "author report" do
97
+ end # class TestAuthorReports
@@ -0,0 +1,159 @@
1
+ require_relative 'helper'
2
+
3
+ SimpleCov.start do
4
+ use_merging true
5
+ merge_timeout 3600
6
+
7
+ add_report :type => SimpleCov::Configuration::ReportTypes::ItemsMissingCoverage::Api
8
+ add_report :type => SimpleCov::Configuration::ReportTypes::ItemsMissingCoverage::Class
9
+ add_report :type => SimpleCov::Configuration::ReportTypes::ItemsMissingCoverage::Method
10
+ add_report :type => SimpleCov::Configuration::ReportTypes::ItemsMissingCoverage::Configure
11
+ add_report(:type => SimpleCov::Configuration::ReportTypes::Author,
12
+ :sub_types => [
13
+ SimpleCov::Configuration::ReportTypes::Author::BestAuthor,
14
+ SimpleCov::Configuration::ReportTypes::Author::AuthorStats
15
+ ],
16
+ :best_authors_count => 3)
17
+ end
18
+
19
+ # Execute code to get coverage
20
+
21
+ require_relative "fixtures/file_report/classes_covered"
22
+ require_relative "fixtures/file_report/classes_not_covered"
23
+ require_relative "fixtures/file_report/classes_partially_covered"
24
+ require_relative "fixtures/file_report/methods_covered"
25
+ require_relative "fixtures/file_report/methods_not_covered"
26
+ require_relative "fixtures/file_report/methods_partially_covered"
27
+
28
+ # Covered classes
29
+ CoveredClass_Empty_None.new
30
+ CoveredClass_Empty_BlankLine.new
31
+ CoveredClass_Empty_Comments.new
32
+ CoveredClass_Code.new.coveredClass_Code_method
33
+ CoveredClass_BlankLine_Code.new.coveredClass_BlankLine_Code_method
34
+ CoveredClass_Comment_Code.new.coveredClass_Comment_Code_method
35
+
36
+ # Partially covered classes
37
+ PartiallyCoveredClass.new.covered_method
38
+
39
+ # Covered methods
40
+ CoveredMethod.new.emptyMethod
41
+ CoveredMethod.new.emptyMethod_BlankLine
42
+ CoveredMethod.new.emptyMethod_Comments
43
+ CoveredMethod.new.method_Code
44
+ CoveredMethod.new.method_BlankLine_Code
45
+ CoveredMethod.new.method_Comment_Code
46
+
47
+ # Non-covered methods
48
+ NonCoveredMethod.new.covered_method
49
+
50
+ # Partially covered methods
51
+ PartiallyCoveredMethod.new.partially_covered_method true
52
+
53
+
54
+ # Tests file reports, namely
55
+ # classes missing coverage
56
+ # methods missing coverage
57
+ # sinatra api missing coverage
58
+ # sinatra configure methods missing coverage
59
+ class TestFileReports < Test::Unit::TestCase
60
+ context "tests: " do
61
+ setup do
62
+ @result = SimpleCov.result.format!
63
+ end
64
+
65
+ context "classes coverage" do
66
+ should "be reported as appropriate" do
67
+ index = 1
68
+ assert_equal :file_report, @result.reports[index][:type][:main], "The first report is a 'file report'"
69
+ assert_equal :class, @result.reports[index][:type][:subtype],
70
+ "The first report is the 'classes missing coverage'"
71
+
72
+ class_coverage_report = @result.reports[index][:items]
73
+
74
+ ## files
75
+ files_in_report = class_coverage_report.keys.map(&:filename).
76
+ collect{ |item| item.slice(/simplecov-reports(.*)/, 1) }
77
+
78
+ expected_files_in_report = [
79
+ "/test/fixtures/file_report/classes_covered.rb",
80
+ "/test/fixtures/file_report/classes_not_covered.rb"
81
+ ]
82
+
83
+ assert_equal expected_files_in_report, files_in_report,
84
+ "CCR: The file list doesn't match the expected set"
85
+
86
+ ## classes
87
+ non_covered_classes = [["class NonCoveredClass"],
88
+ ["class NonCoveredClass_Empty_None",
89
+ "class NonCoveredClass_Empty_BlankLine",
90
+ "class NonCoveredClass_Empty_Comments",
91
+ "class NonCoveredClass_Code",
92
+ "class NonCoveredClass_Comment_Code",
93
+ "class NonCoveredClass_BlankLine_Code"]]
94
+
95
+ assert_equal non_covered_classes,
96
+ class_coverage_report.values.collect{ |item| item.map(&:src).map(&:strip) },
97
+ "CCR: The non-covered classes don't match the expected set"
98
+ end
99
+ end
100
+
101
+ context "methods coverage" do
102
+ should "be reported as appropriate" do
103
+ index = 2
104
+ assert_equal :file_report, @result.reports[index][:type][:main], "The second report is a 'file report'"
105
+ assert_equal :method, @result.reports[index][:type][:subtype],
106
+ "The second report is the 'methods missing coverage'"
107
+
108
+ method_coverage_report = @result.reports[index][:items]
109
+
110
+ ## files
111
+ files_in_report = method_coverage_report.keys.map(&:filename).
112
+ collect{ |item| item.slice(/simplecov-reports(.*)/, 1) }
113
+
114
+ expected_files_in_report = ["/test/fixtures/file_report/classes_covered.rb",
115
+ "/test/fixtures/file_report/classes_not_covered.rb",
116
+ "/test/fixtures/file_report/classes_partially_covered.rb",
117
+ "/test/fixtures/file_report/methods_covered.rb",
118
+ "/test/fixtures/file_report/methods_not_covered.rb"]
119
+
120
+ assert_equal expected_files_in_report, files_in_report,
121
+ "MCR: The file list doesn't match the expected set"
122
+
123
+ ## Methods
124
+ non_covered_methods = [["def non_covered_method"],
125
+ ["def nonCoveredClass_Code_method",
126
+ "def nonCoveredClass_Comment_Code_method",
127
+ "def nonCoveredClass_BlankLine_Code_method"],
128
+ ["def non_covered_method"],
129
+ ["def non_covered_method"],
130
+ ["def emptyMethod",
131
+ "def emptyMethod_BlankLine",
132
+ "def emptyMethod_Comments",
133
+ "def method_Code",
134
+ "def method_Comment_Code",
135
+ "def method_BlankLine_Code"]]
136
+
137
+ assert_equal non_covered_methods,
138
+ method_coverage_report.values.collect{ |item| item.map(&:src).map(&:strip) },
139
+ "MCR: The non-covered methods don't match the expected set"
140
+
141
+ end
142
+ end
143
+
144
+ #TODO (rkonda, 06/27/2013): Add tests
145
+ context "sinatra api method regex" do
146
+ should "match as expected" do
147
+ end
148
+ end
149
+
150
+ #TODO (rkonda, 06/27/2013): Add tests
151
+ context "sinatra configure method coverage" do
152
+ should "match as expected" do
153
+ end
154
+ end
155
+
156
+ end # context "tests: " do
157
+
158
+ end # class TestFileReports
159
+