simplecov 0.13.0 → 0.17.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (125) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +99 -3
  3. data/CONTRIBUTING.md +12 -9
  4. data/ISSUE_TEMPLATE.md +23 -0
  5. data/{MIT-LICENSE → LICENSE} +1 -1
  6. data/README.md +90 -43
  7. data/doc/alternate-formatters.md +21 -1
  8. data/doc/editor-integration.md +6 -1
  9. data/lib/simplecov.rb +131 -13
  10. data/lib/simplecov/command_guesser.rb +2 -0
  11. data/lib/simplecov/configuration.rb +34 -25
  12. data/lib/simplecov/defaults.rb +12 -82
  13. data/lib/simplecov/exit_codes.rb +2 -0
  14. data/lib/simplecov/file_list.rb +7 -5
  15. data/lib/simplecov/filter.rb +41 -4
  16. data/lib/simplecov/formatter.rb +2 -0
  17. data/lib/simplecov/formatter/multi_formatter.rb +2 -0
  18. data/lib/simplecov/formatter/simple_formatter.rb +3 -1
  19. data/lib/simplecov/jruby_fix.rb +2 -0
  20. data/lib/simplecov/last_run.rb +5 -1
  21. data/lib/simplecov/lines_classifier.rb +48 -0
  22. data/lib/simplecov/load_global_config.rb +8 -0
  23. data/lib/simplecov/no_defaults.rb +2 -0
  24. data/lib/simplecov/profiles.rb +2 -0
  25. data/lib/simplecov/profiles/bundler_filter.rb +5 -0
  26. data/lib/simplecov/profiles/hidden_filter.rb +5 -0
  27. data/lib/simplecov/profiles/rails.rb +18 -0
  28. data/lib/simplecov/profiles/root_filter.rb +10 -0
  29. data/lib/simplecov/profiles/test_frameworks.rb +8 -0
  30. data/lib/simplecov/railtie.rb +2 -0
  31. data/lib/simplecov/railties/tasks.rake +2 -0
  32. data/lib/simplecov/raw_coverage.rb +41 -0
  33. data/lib/simplecov/result.rb +2 -1
  34. data/lib/simplecov/result_merger.rb +56 -21
  35. data/lib/simplecov/source_file.rb +43 -34
  36. data/lib/simplecov/version.rb +3 -23
  37. metadata +131 -99
  38. data/.gitignore +0 -31
  39. data/.rspec +0 -3
  40. data/.rubocop.yml +0 -84
  41. data/.travis.yml +0 -32
  42. data/.yardopts +0 -1
  43. data/Gemfile +0 -38
  44. data/Rakefile +0 -41
  45. data/cucumber.yml +0 -13
  46. data/features/config_autoload.feature +0 -46
  47. data/features/config_command_name.feature +0 -45
  48. data/features/config_coverage_dir.feature +0 -33
  49. data/features/config_deactivate_merging.feature +0 -42
  50. data/features/config_formatters.feature +0 -77
  51. data/features/config_merge_timeout.feature +0 -39
  52. data/features/config_nocov_token.feature +0 -79
  53. data/features/config_profiles.feature +0 -44
  54. data/features/config_project_name.feature +0 -27
  55. data/features/config_styles.feature +0 -121
  56. data/features/config_tracked_files.feature +0 -29
  57. data/features/cucumber_basic.feature +0 -29
  58. data/features/maximum_coverage_drop.feature +0 -36
  59. data/features/merging_test_unit_and_rspec.feature +0 -44
  60. data/features/minimum_coverage.feature +0 -59
  61. data/features/refuse_coverage_drop.feature +0 -35
  62. data/features/rspec_basic.feature +0 -32
  63. data/features/rspec_fails_on_initialization.feature +0 -14
  64. data/features/rspec_groups_and_filters_basic.feature +0 -29
  65. data/features/rspec_groups_and_filters_complex.feature +0 -37
  66. data/features/rspec_groups_using_filter_class.feature +0 -41
  67. data/features/rspec_without_simplecov.feature +0 -20
  68. data/features/skipping_code_blocks_manually.feature +0 -70
  69. data/features/step_definitions/html_steps.rb +0 -44
  70. data/features/step_definitions/simplecov_steps.rb +0 -68
  71. data/features/step_definitions/transformers.rb +0 -13
  72. data/features/step_definitions/web_steps.rb +0 -64
  73. data/features/support/env.rb +0 -50
  74. data/features/test_unit_basic.feature +0 -34
  75. data/features/test_unit_groups_and_filters_basic.feature +0 -29
  76. data/features/test_unit_groups_and_filters_complex.feature +0 -35
  77. data/features/test_unit_groups_using_filter_class.feature +0 -40
  78. data/features/test_unit_without_simplecov.feature +0 -20
  79. data/features/unicode_compatiblity.feature +0 -67
  80. data/lib/simplecov/merge_helpers.rb +0 -37
  81. data/simplecov.gemspec +0 -27
  82. data/spec/1_8_fallbacks_spec.rb +0 -31
  83. data/spec/command_guesser_spec.rb +0 -48
  84. data/spec/deleted_source_spec.rb +0 -12
  85. data/spec/faked_project/Gemfile +0 -6
  86. data/spec/faked_project/Rakefile +0 -8
  87. data/spec/faked_project/cucumber.yml +0 -13
  88. data/spec/faked_project/features/step_definitions/my_steps.rb +0 -22
  89. data/spec/faked_project/features/support/env.rb +0 -12
  90. data/spec/faked_project/features/test_stuff.feature +0 -6
  91. data/spec/faked_project/lib/faked_project.rb +0 -11
  92. data/spec/faked_project/lib/faked_project/framework_specific.rb +0 -18
  93. data/spec/faked_project/lib/faked_project/meta_magic.rb +0 -24
  94. data/spec/faked_project/lib/faked_project/some_class.rb +0 -28
  95. data/spec/faked_project/lib/faked_project/untested_class.rb +0 -11
  96. data/spec/faked_project/spec/faked_spec.rb +0 -11
  97. data/spec/faked_project/spec/forking_spec.rb +0 -8
  98. data/spec/faked_project/spec/meta_magic_spec.rb +0 -15
  99. data/spec/faked_project/spec/some_class_spec.rb +0 -13
  100. data/spec/faked_project/spec/spec_helper.rb +0 -11
  101. data/spec/faked_project/test/faked_test.rb +0 -11
  102. data/spec/faked_project/test/meta_magic_test.rb +0 -13
  103. data/spec/faked_project/test/some_class_test.rb +0 -15
  104. data/spec/faked_project/test/test_helper.rb +0 -12
  105. data/spec/file_list_spec.rb +0 -50
  106. data/spec/filters_spec.rb +0 -98
  107. data/spec/fixtures/app/controllers/sample_controller.rb +0 -10
  108. data/spec/fixtures/app/models/user.rb +0 -10
  109. data/spec/fixtures/deleted_source_sample.rb +0 -15
  110. data/spec/fixtures/frameworks/rspec_bad.rb +0 -9
  111. data/spec/fixtures/frameworks/rspec_good.rb +0 -9
  112. data/spec/fixtures/frameworks/testunit_bad.rb +0 -9
  113. data/spec/fixtures/frameworks/testunit_good.rb +0 -9
  114. data/spec/fixtures/iso-8859.rb +0 -3
  115. data/spec/fixtures/resultset1.rb +0 -4
  116. data/spec/fixtures/resultset2.rb +0 -4
  117. data/spec/fixtures/sample.rb +0 -16
  118. data/spec/fixtures/utf-8.rb +0 -3
  119. data/spec/helper.rb +0 -24
  120. data/spec/merge_helpers_spec.rb +0 -126
  121. data/spec/multi_formatter_spec.rb +0 -20
  122. data/spec/result_spec.rb +0 -209
  123. data/spec/return_codes_spec.rb +0 -34
  124. data/spec/source_file_line_spec.rb +0 -155
  125. data/spec/source_file_spec.rb +0 -77
@@ -1,10 +0,0 @@
1
- # Foo class
2
- class Foo
3
- def initialize
4
- @foo = "baz"
5
- end
6
-
7
- def bar
8
- @foo
9
- end
10
- end
@@ -1,10 +0,0 @@
1
- # Foo class
2
- class Foo
3
- def initialize
4
- @foo = "baz"
5
- end
6
-
7
- def bar
8
- @foo
9
- end
10
- end
@@ -1,15 +0,0 @@
1
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), "..", ".."))
2
- require "lib/simplecov"
3
- SimpleCov.start { command_name "Test" }
4
-
5
- dir = File.expand_path(File.dirname(__FILE__))
6
- file = File.join(dir, "generated_buddha.rb")
7
- code = %{
8
- def kill_the_buddha(z)
9
- z**z
10
- end
11
- }
12
- File.open(file, "w") { |f| f.print code }
13
- load file
14
- File.unlink file
15
- raise unless kill_the_buddha(3) == 27
@@ -1,9 +0,0 @@
1
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), "..", "..", ".."))
2
- require "lib/simplecov"
3
- require "rspec"
4
- SimpleCov.start
5
- describe "exit status" do
6
- it "should exit with a non-zero exit status when assertion fails" do
7
- expect(1).to eq(2)
8
- end
9
- end
@@ -1,9 +0,0 @@
1
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), "..", "..", ".."))
2
- require "lib/simplecov"
3
- require "rspec"
4
- SimpleCov.start
5
- describe "exit status" do
6
- it "should exit with a zero exit status when assertion fails" do
7
- expect(1).to eq(1)
8
- end
9
- end
@@ -1,9 +0,0 @@
1
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), "..", "..", ".."))
2
- require "lib/simplecov"
3
- SimpleCov.start
4
- require "test/unit"
5
- class FooTest < Test::Unit::TestCase
6
- def test_foo
7
- assert false
8
- end
9
- end
@@ -1,9 +0,0 @@
1
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), "..", "..", ".."))
2
- require "lib/simplecov"
3
- SimpleCov.start
4
- require "test/unit"
5
- class FooTest < Test::Unit::TestCase
6
- def test_foo
7
- assert true
8
- end
9
- end
@@ -1,3 +0,0 @@
1
-
2
- # localized to Espa�ol thus:
3
-
@@ -1,4 +0,0 @@
1
- puts "foo"
2
- puts "foo"
3
- puts "foo"
4
- puts "foo"
@@ -1,4 +0,0 @@
1
-
2
- class Resultset
3
- VERSION = 2
4
- end
@@ -1,16 +0,0 @@
1
- # Foo class
2
- class Foo
3
- def initialize
4
- @foo = "baz"
5
- end
6
-
7
- def bar
8
- @foo
9
- end
10
-
11
- #:nocov:
12
- def skipped
13
- @foo * 2
14
- end
15
- #:nocov:
16
- end
@@ -1,3 +0,0 @@
1
- # encoding: utf-8
2
-
3
- puts "135°C"
data/spec/helper.rb DELETED
@@ -1,24 +0,0 @@
1
- require "simplecov"
2
- require "rspec"
3
-
4
- SimpleCov.coverage_dir("tmp/coverage")
5
-
6
- def source_fixture(filename)
7
- File.expand_path(File.join(File.dirname(__FILE__), "fixtures", filename))
8
- end
9
-
10
- # Taken from http://stackoverflow.com/questions/4459330/how-do-i-temporarily-redirect-stderr-in-ruby
11
- require "stringio"
12
-
13
- def capture_stderr
14
- # The output stream must be an IO-like object. In this case we capture it in
15
- # an in-memory IO object so we can return the string value. You can assign any
16
- # IO object here.
17
- previous_stderr = $stderr
18
- $stderr = StringIO.new
19
- yield
20
- $stderr.string
21
- ensure
22
- # Restore the previous value of stderr (typically equal to STDERR).
23
- $stderr = previous_stderr
24
- end
@@ -1,126 +0,0 @@
1
- require "helper"
2
-
3
- if SimpleCov.usable?
4
- describe "merge helpers" do
5
- describe "with two faked coverage resultsets" do
6
- before do
7
- SimpleCov.use_merging true
8
- @resultset1 = {
9
- source_fixture("sample.rb") => [nil, 1, 1, 1, nil, nil, 1, 1, nil, nil],
10
- source_fixture("app/models/user.rb") => [nil, 1, 1, 1, nil, nil, 1, 0, nil, nil],
11
- source_fixture("app/controllers/sample_controller.rb") => [nil, 1, 1, 1, nil, nil, 1, 0, nil, nil],
12
- source_fixture("resultset1.rb") => [1, 1, 1, 1],
13
- source_fixture("parallel_tests.rb") => [nil, 0, nil, 0],
14
- source_fixture("conditionally_loaded_1.rb") => [nil, 0, 1], # loaded only in the first resultset
15
- }.extend(SimpleCov::HashMergeHelper)
16
-
17
- @resultset2 = {
18
- source_fixture("sample.rb") => [1, nil, 1, 1, nil, nil, 1, 1, nil, nil],
19
- source_fixture("app/models/user.rb") => [nil, 1, 5, 1, nil, nil, 1, 0, nil, nil],
20
- source_fixture("app/controllers/sample_controller.rb") => [nil, 3, 1, nil, nil, nil, 1, 0, nil, nil],
21
- source_fixture("resultset2.rb") => [nil, 1, 1, nil],
22
- source_fixture("parallel_tests.rb") => [nil, nil, 0, 0],
23
- source_fixture("conditionally_loaded_2.rb") => [nil, 0, 1], # loaded only in the second resultset
24
- }
25
- end
26
-
27
- context "a merge" do
28
- subject do
29
- @resultset1.merge_resultset(@resultset2)
30
- end
31
-
32
- it "has proper results for sample.rb" do
33
- expect(subject[source_fixture("sample.rb")]).to eq([1, 1, 2, 2, nil, nil, 2, 2, nil, nil])
34
- end
35
-
36
- it "has proper results for user.rb" do
37
- expect(subject[source_fixture("app/models/user.rb")]).to eq([nil, 2, 6, 2, nil, nil, 2, 0, nil, nil])
38
- end
39
-
40
- it "has proper results for sample_controller.rb" do
41
- expect(subject[source_fixture("app/controllers/sample_controller.rb")]).to eq([nil, 4, 2, 1, nil, nil, 2, 0, nil, nil])
42
- end
43
-
44
- it "has proper results for resultset1.rb" do
45
- expect(subject[source_fixture("resultset1.rb")]).to eq([1, 1, 1, 1])
46
- end
47
-
48
- it "has proper results for resultset2.rb" do
49
- expect(subject[source_fixture("resultset2.rb")]).to eq([nil, 1, 1, nil])
50
- end
51
-
52
- it "has proper results for parallel_tests.rb" do
53
- expect(subject[source_fixture("parallel_tests.rb")]).to eq([nil, nil, nil, 0])
54
- end
55
-
56
- it "has proper results for conditionally_loaded_1.rb" do
57
- expect(subject[source_fixture("conditionally_loaded_1.rb")]).to eq([nil, 0, 1])
58
- end
59
-
60
- it "has proper results for conditionally_loaded_2.rb" do
61
- expect(subject[source_fixture("conditionally_loaded_2.rb")]).to eq([nil, 0, 1])
62
- end
63
- end
64
-
65
- # See Github issue #6
66
- it "returns an empty hash when the resultset cache file is empty" do
67
- File.open(SimpleCov::ResultMerger.resultset_path, "w+") { |f| f.puts "" }
68
- expect(SimpleCov::ResultMerger.resultset).to be_empty
69
- end
70
-
71
- # See Github issue #6
72
- it "returns an empty hash when the resultset cache file is not present" do
73
- system "rm #{SimpleCov::ResultMerger.resultset_path}" if File.exist?(SimpleCov::ResultMerger.resultset_path)
74
- expect(SimpleCov::ResultMerger.resultset).to be_empty
75
- end
76
-
77
- context "and results generated from those" do
78
- before do
79
- system "rm #{SimpleCov::ResultMerger.resultset_path}" if File.exist?(SimpleCov::ResultMerger.resultset_path)
80
- @result1 = SimpleCov::Result.new(@resultset1)
81
- @result1.command_name = "result1"
82
- @result2 = SimpleCov::Result.new(@resultset2)
83
- @result2.command_name = "result2"
84
- end
85
-
86
- context "with stored results" do
87
- before do
88
- SimpleCov::ResultMerger.store_result(@result1)
89
- SimpleCov::ResultMerger.store_result(@result2)
90
- end
91
-
92
- it "has stored data in resultset_path JSON file" do
93
- expect(File.readlines(SimpleCov::ResultMerger.resultset_path).length).to be > 50
94
- end
95
-
96
- it "returns a hash containing keys ['result1' and 'result2'] for resultset" do
97
- expect(SimpleCov::ResultMerger.resultset.keys.sort).to eq %w(result1 result2)
98
- end
99
-
100
- it "returns proper values for merged_result" do
101
- expect(SimpleCov::ResultMerger.merged_result.source_files.find { |s| s.filename =~ /user/ }.lines.map(&:coverage)).to eq([nil, 2, 6, 2, nil, nil, 2, 0, nil, nil])
102
- end
103
-
104
- context "with second result way above the merge_timeout" do
105
- before do
106
- @result2.created_at = Time.now - 172_800 # two days ago
107
- SimpleCov::ResultMerger.store_result(@result2)
108
- end
109
-
110
- it "has only one result in SimpleCov::ResultMerger.results" do
111
- expect(SimpleCov::ResultMerger.results.length).to eq(1)
112
- end
113
- end
114
-
115
- context "with merging disabled" do
116
- before { SimpleCov.use_merging false }
117
-
118
- it "returns nil for SimpleCov.result" do
119
- expect(SimpleCov.result).to be_nil
120
- end
121
- end
122
- end
123
- end
124
- end
125
- end
126
- end
@@ -1,20 +0,0 @@
1
- require "helper"
2
-
3
- require "simplecov/formatter/multi_formatter"
4
-
5
- describe SimpleCov::Formatter::MultiFormatter do
6
- describe ".[]" do
7
- # Regression test for https://github.com/colszowka/simplecov/issues/428
8
- it "constructs a formatter with multiple children" do
9
- # Silence deprecation warnings.
10
- allow(described_class).to receive(:warn)
11
-
12
- children = [
13
- SimpleCov::Formatter::SimpleFormatter,
14
- SimpleCov::Formatter::SimpleFormatter,
15
- ]
16
-
17
- expect(described_class[*children].new.formatters).to eq(children)
18
- end
19
- end
20
- end
data/spec/result_spec.rb DELETED
@@ -1,209 +0,0 @@
1
- require "helper"
2
-
3
- if SimpleCov.usable?
4
- describe "result" do
5
- context "with a (mocked) Coverage.result" do
6
- before do
7
- @prev_filters = SimpleCov.filters
8
- SimpleCov.filters = []
9
- @prev_groups = SimpleCov.groups
10
- SimpleCov.groups = {}
11
- @prev_formatter = SimpleCov.formatter
12
- SimpleCov.formatter = nil
13
- end
14
-
15
- after do
16
- SimpleCov.filters = @prev_filters
17
- SimpleCov.groups = @prev_groups
18
- SimpleCov.formatter = @prev_formatter
19
- end
20
-
21
- let(:original_result) do
22
- {
23
- source_fixture("sample.rb") => [nil, 1, 1, 1, nil, nil, 1, 1, nil, nil],
24
- source_fixture("app/models/user.rb") => [nil, 1, 1, 1, nil, nil, 1, 0, nil, nil],
25
- source_fixture("app/controllers/sample_controller.rb") => [nil, 1, 1, 1, nil, nil, 1, 0, nil, nil],
26
- }
27
- end
28
-
29
- context "a simple cov result initialized from that" do
30
- subject { SimpleCov::Result.new(original_result) }
31
-
32
- it "has 3 filenames" do
33
- expect(subject.filenames.count).to eq(3)
34
- end
35
-
36
- it "has 3 source files" do
37
- expect(subject.source_files.count).to eq(3)
38
- subject.source_files.each do |source_file|
39
- expect(source_file).to be_a SimpleCov::SourceFile
40
- end
41
- end
42
-
43
- it "returns an instance of SimpleCov::FileList for source_files and files" do
44
- expect(subject.files).to be_a SimpleCov::FileList
45
- expect(subject.source_files).to be_a SimpleCov::FileList
46
- end
47
-
48
- it "has files equal to source_files" do
49
- expect(subject.files).to eq(subject.source_files)
50
- end
51
-
52
- it "has accurate covered percent" do
53
- # in our fixture, there are 13 covered line (result in 1) in all 15 relevant line (result in non-nil)
54
- expect(subject.covered_percent).to eq(86.66666666666667)
55
- end
56
-
57
- it "has accurate covered percentages" do
58
- expect(subject.covered_percentages).to eq([80.0, 80.0, 100.0])
59
- end
60
-
61
- it "has accurate least covered file" do
62
- expect(subject.least_covered_file).to match(/sample_controller.rb/)
63
- end
64
-
65
- [:covered_percent, :covered_percentages, :least_covered_file, :covered_strength, :covered_lines, :missed_lines, :total_lines].each do |msg|
66
- it "responds to #{msg}" do
67
- expect(subject).to respond_to(msg)
68
- end
69
- end
70
-
71
- context "dumped with to_hash" do
72
- it "is a hash" do
73
- expect(subject.to_hash).to be_a Hash
74
- end
75
-
76
- context "loaded back with from_hash" do
77
- let(:dumped_result) do
78
- SimpleCov::Result.from_hash(subject.to_hash)
79
- end
80
-
81
- it "has 3 source files" do
82
- expect(dumped_result.source_files.count).to eq(subject.source_files.count)
83
- end
84
-
85
- it "has the same covered_percent" do
86
- expect(dumped_result.covered_percent).to eq(subject.covered_percent)
87
- end
88
-
89
- it "has the same covered_percentages" do
90
- expect(dumped_result.covered_percentages).to eq(subject.covered_percentages)
91
- end
92
-
93
- it "has the same timestamp" do
94
- expect(dumped_result.created_at.to_i).to eq(subject.created_at.to_i)
95
- end
96
-
97
- it "has the same command_name" do
98
- expect(dumped_result.command_name).to eq(subject.command_name)
99
- end
100
-
101
- it "has the same original_result" do
102
- expect(dumped_result.original_result).to eq(subject.original_result)
103
- end
104
- end
105
- end
106
- end
107
-
108
- context "with some filters set up" do
109
- before do
110
- SimpleCov.add_filter "sample.rb"
111
- end
112
-
113
- it "has 2 files in a new simple cov result" do
114
- expect(SimpleCov::Result.new(original_result).source_files.length).to eq(2)
115
- end
116
-
117
- it "has 80 covered percent" do
118
- expect(SimpleCov::Result.new(original_result).covered_percent).to eq(80)
119
- end
120
-
121
- it "has [80.0, 80.0] covered percentages" do
122
- expect(SimpleCov::Result.new(original_result).covered_percentages).to eq([80.0, 80.0])
123
- end
124
- end
125
-
126
- context "with groups set up for all files" do
127
- before do
128
- SimpleCov.add_group "Models", "app/models"
129
- SimpleCov.add_group "Controllers", ["app/controllers"]
130
- SimpleCov.add_group "Other" do |src_file|
131
- File.basename(src_file.filename) == "sample.rb"
132
- end
133
- end
134
-
135
- subject do
136
- SimpleCov::Result.new(original_result)
137
- end
138
-
139
- it "has 3 groups" do
140
- expect(subject.groups.length).to eq(3)
141
- end
142
-
143
- it "has user.rb in 'Models' group" do
144
- expect(File.basename(subject.groups["Models"].first.filename)).to eq("user.rb")
145
- end
146
-
147
- it "has sample_controller.rb in 'Controllers' group" do
148
- expect(File.basename(subject.groups["Controllers"].first.filename)).to eq("sample_controller.rb")
149
- end
150
-
151
- context "and simple formatter being used" do
152
- before do
153
- SimpleCov.formatter = SimpleCov::Formatter::SimpleFormatter
154
- end
155
-
156
- it "returns a formatted string with result.format!" do
157
- expect(subject.format!).to be_a String
158
- end
159
- end
160
-
161
- context "and multi formatter being used" do
162
- before do
163
- SimpleCov.formatters = [
164
- SimpleCov::Formatter::SimpleFormatter,
165
- SimpleCov::Formatter::SimpleFormatter,
166
- ]
167
- end
168
-
169
- it "returns an array containing formatted string with result.format!" do
170
- formatted = subject.format!
171
- expect(formatted.count).to eq(2)
172
- expect(formatted.first).to be_a String
173
- end
174
- end
175
- end
176
-
177
- context "with groups set up that do not match all files" do
178
- before do
179
- SimpleCov.configure do
180
- add_group "Models", "app/models"
181
- add_group "Controllers", "app/controllers"
182
- end
183
- end
184
-
185
- subject { SimpleCov::Result.new(original_result) }
186
-
187
- it "has 3 groups" do
188
- expect(subject.groups.length).to eq(3)
189
- end
190
-
191
- it "has 1 item per group" do
192
- subject.groups.each_value do |files|
193
- expect(files.length).to eq(1)
194
- end
195
- end
196
-
197
- it 'has sample.rb in "Ungrouped" group' do
198
- expect(File.basename(subject.groups["Ungrouped"].first.filename)).to eq("sample.rb")
199
- end
200
-
201
- it "returns all groups as instances of SimpleCov::FileList" do
202
- subject.groups.each_value do |files|
203
- expect(files).to be_a SimpleCov::FileList
204
- end
205
- end
206
- end
207
- end
208
- end
209
- end