simplecov 0.12.0 → 0.13.0

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.
@@ -1,38 +1,70 @@
1
1
  require "helper"
2
2
 
3
- describe SimpleCov::SourceFile::Line do
4
- context "a source line" do
5
- subject do
6
- SimpleCov::SourceFile::Line.new("# the ruby source", 5, 3)
7
- end
3
+ if SimpleCov.usable?
4
+ describe SimpleCov::SourceFile::Line do
5
+ context "a source line" do
6
+ subject do
7
+ SimpleCov::SourceFile::Line.new("# the ruby source", 5, 3)
8
+ end
8
9
 
9
- it 'returns "# the ruby source" as src' do
10
- expect(subject.src).to eq("# the ruby source")
11
- end
10
+ it 'returns "# the ruby source" as src' do
11
+ expect(subject.src).to eq("# the ruby source")
12
+ end
12
13
 
13
- it "returns the same for source as for src" do
14
- expect(subject.src).to eq(subject.source)
15
- end
14
+ it "returns the same for source as for src" do
15
+ expect(subject.src).to eq(subject.source)
16
+ end
16
17
 
17
- it "has line number 5" do
18
- expect(subject.line_number).to eq(5)
19
- end
18
+ it "has line number 5" do
19
+ expect(subject.line_number).to eq(5)
20
+ end
20
21
 
21
- it "has equal line_number, line and number" do
22
- expect(subject.line).to eq(subject.line_number)
23
- expect(subject.number).to eq(subject.line_number)
22
+ it "has equal line_number, line and number" do
23
+ expect(subject.line).to eq(subject.line_number)
24
+ expect(subject.number).to eq(subject.line_number)
25
+ end
26
+
27
+ context "flagged as skipped!" do
28
+ before do
29
+ subject.skipped!
30
+ end
31
+ it "is not covered" do
32
+ expect(subject).not_to be_covered
33
+ end
34
+
35
+ it "is skipped" do
36
+ expect(subject).to be_skipped
37
+ end
38
+
39
+ it "is not missed" do
40
+ expect(subject).not_to be_missed
41
+ end
42
+
43
+ it "is not never" do
44
+ expect(subject).not_to be_never
45
+ end
46
+
47
+ it "status is skipped" do
48
+ expect(subject.status).to eq("skipped")
49
+ end
50
+ end
24
51
  end
25
52
 
26
- context "flagged as skipped!" do
27
- before do
28
- subject.skipped!
53
+ context "A source line with coverage" do
54
+ subject do
55
+ SimpleCov::SourceFile::Line.new("# the ruby source", 5, 3)
29
56
  end
30
- it "is not covered" do
31
- expect(subject).not_to be_covered
57
+
58
+ it "has coverage of 3" do
59
+ expect(subject.coverage).to eq(3)
60
+ end
61
+
62
+ it "is covered" do
63
+ expect(subject).to be_covered
32
64
  end
33
65
 
34
- it "is skipped" do
35
- expect(subject).to be_skipped
66
+ it "is not skipped" do
67
+ expect(subject).not_to be_skipped
36
68
  end
37
69
 
38
70
  it "is not missed" do
@@ -43,111 +75,81 @@ describe SimpleCov::SourceFile::Line do
43
75
  expect(subject).not_to be_never
44
76
  end
45
77
 
46
- it "status is skipped" do
47
- expect(subject.status).to eq("skipped")
78
+ it "status is covered" do
79
+ expect(subject.status).to eq("covered")
48
80
  end
49
81
  end
50
- end
51
-
52
- context "A source line with coverage" do
53
- subject do
54
- SimpleCov::SourceFile::Line.new("# the ruby source", 5, 3)
55
- end
56
82
 
57
- it "has coverage of 3" do
58
- expect(subject.coverage).to eq(3)
59
- end
60
-
61
- it "is covered" do
62
- expect(subject).to be_covered
63
- end
64
-
65
- it "is not skipped" do
66
- expect(subject).not_to be_skipped
67
- end
68
-
69
- it "is not missed" do
70
- expect(subject).not_to be_missed
71
- end
83
+ context "A source line without coverage" do
84
+ subject do
85
+ SimpleCov::SourceFile::Line.new("# the ruby source", 5, 0)
86
+ end
72
87
 
73
- it "is not never" do
74
- expect(subject).not_to be_never
75
- end
88
+ it "has coverage of 0" do
89
+ expect(subject.coverage).to be_zero
90
+ end
76
91
 
77
- it "status is covered" do
78
- expect(subject.status).to eq("covered")
79
- end
80
- end
92
+ it "is not covered" do
93
+ expect(subject).not_to be_covered
94
+ end
81
95
 
82
- context "A source line without coverage" do
83
- subject do
84
- SimpleCov::SourceFile::Line.new("# the ruby source", 5, 0)
85
- end
96
+ it "is not skipped" do
97
+ expect(subject).not_to be_skipped
98
+ end
86
99
 
87
- it "has coverage of 0" do
88
- expect(subject.coverage).to be_zero
89
- end
100
+ it "is missed" do
101
+ expect(subject).to be_missed
102
+ end
90
103
 
91
- it "is not covered" do
92
- expect(subject).not_to be_covered
93
- end
104
+ it "is not never" do
105
+ expect(subject).not_to be_never
106
+ end
94
107
 
95
- it "is not skipped" do
96
- expect(subject).not_to be_skipped
108
+ it "status is missed" do
109
+ expect(subject.status).to eq("missed")
110
+ end
97
111
  end
98
112
 
99
- it "is missed" do
100
- expect(subject).to be_missed
101
- end
113
+ context "A source line with no code" do
114
+ subject do
115
+ SimpleCov::SourceFile::Line.new("# the ruby source", 5, nil)
116
+ end
102
117
 
103
- it "is not never" do
104
- expect(subject).not_to be_never
105
- end
118
+ it "has nil coverage" do
119
+ expect(subject.coverage).to be_nil
120
+ end
106
121
 
107
- it "status is missed" do
108
- expect(subject.status).to eq("missed")
109
- end
110
- end
122
+ it "is not covered" do
123
+ expect(subject).not_to be_covered
124
+ end
111
125
 
112
- context "A source line with no code" do
113
- subject do
114
- SimpleCov::SourceFile::Line.new("# the ruby source", 5, nil)
115
- end
126
+ it "is not skipped" do
127
+ expect(subject).not_to be_skipped
128
+ end
116
129
 
117
- it "has nil coverage" do
118
- expect(subject.coverage).to be_nil
119
- end
130
+ it "is not missed" do
131
+ expect(subject).not_to be_missed
132
+ end
120
133
 
121
- it "is not covered" do
122
- expect(subject).not_to be_covered
123
- end
134
+ it "is never" do
135
+ expect(subject).to be_never
136
+ end
124
137
 
125
- it "is not skipped" do
126
- expect(subject).not_to be_skipped
138
+ it "status is never" do
139
+ expect(subject.status).to eq("never")
140
+ end
127
141
  end
128
142
 
129
- it "is not missed" do
130
- expect(subject).not_to be_missed
143
+ it "raises ArgumentError when initialized with invalid src" do
144
+ expect { SimpleCov::SourceFile::Line.new(:symbol, 5, 3) }.to raise_error(ArgumentError)
131
145
  end
132
146
 
133
- it "is never" do
134
- expect(subject).to be_never
147
+ it "raises ArgumentError when initialized with invalid line_number" do
148
+ expect { SimpleCov::SourceFile::Line.new("some source", "five", 3) }.to raise_error(ArgumentError)
135
149
  end
136
150
 
137
- it "status is never" do
138
- expect(subject.status).to eq("never")
151
+ it "raises ArgumentError when initialized with invalid coverage" do
152
+ expect { SimpleCov::SourceFile::Line.new("some source", 5, "three") }.to raise_error(ArgumentError)
139
153
  end
140
154
  end
141
-
142
- it "raises ArgumentError when initialized with invalid src" do
143
- expect { SimpleCov::SourceFile::Line.new(:symbol, 5, 3) }.to raise_error(ArgumentError)
144
- end
145
-
146
- it "raises ArgumentError when initialized with invalid line_number" do
147
- expect { SimpleCov::SourceFile::Line.new("some source", "five", 3) }.to raise_error(ArgumentError)
148
- end
149
-
150
- it "raises ArgumentError when initialized with invalid coverage" do
151
- expect { SimpleCov::SourceFile::Line.new("some source", 5, "three") }.to raise_error(ArgumentError)
152
- end
153
- end if SimpleCov.usable?
155
+ end
@@ -1,75 +1,77 @@
1
1
  require "helper"
2
2
 
3
- describe SimpleCov::SourceFile do
4
- COVERAGE_FOR_SAMPLE_RB = [nil, 1, 1, 1, nil, nil, 1, 0, nil, nil, nil, nil, nil, nil, nil, nil].freeze
5
- context "a source file initialized with some coverage data" do
6
- subject do
7
- SimpleCov::SourceFile.new(source_fixture("sample.rb"), COVERAGE_FOR_SAMPLE_RB)
8
- end
9
-
10
- it "has a filename" do
11
- expect(subject.filename).not_to be_nil
12
- end
3
+ if SimpleCov.usable?
4
+ describe SimpleCov::SourceFile do
5
+ COVERAGE_FOR_SAMPLE_RB = [nil, 1, 1, 1, nil, nil, 1, 0, nil, nil, nil, nil, nil, nil, nil, nil].freeze
6
+ context "a source file initialized with some coverage data" do
7
+ subject do
8
+ SimpleCov::SourceFile.new(source_fixture("sample.rb"), COVERAGE_FOR_SAMPLE_RB)
9
+ end
13
10
 
14
- it "has source equal to src" do
15
- expect(subject.src).to eq(subject.source)
16
- end
11
+ it "has a filename" do
12
+ expect(subject.filename).not_to be_nil
13
+ end
17
14
 
18
- it "has source_lines equal to lines" do
19
- expect(subject.lines).to eq(subject.source_lines)
20
- end
15
+ it "has source equal to src" do
16
+ expect(subject.src).to eq(subject.source)
17
+ end
21
18
 
22
- it "has 16 source lines" do
23
- expect(subject.lines.count).to eq(16)
24
- end
19
+ it "has source_lines equal to lines" do
20
+ expect(subject.lines).to eq(subject.source_lines)
21
+ end
25
22
 
26
- it "has all source lines of type SimpleCov::SourceFile::Line" do
27
- subject.lines.each do |line|
28
- expect(line).to be_a SimpleCov::SourceFile::Line
23
+ it "has 16 source lines" do
24
+ expect(subject.lines.count).to eq(16)
29
25
  end
30
- end
31
26
 
32
- it "has 'class Foo' as line(2).source" do
33
- expect(subject.line(2).source).to eq("class Foo\n")
34
- end
27
+ it "has all source lines of type SimpleCov::SourceFile::Line" do
28
+ subject.lines.each do |line|
29
+ expect(line).to be_a SimpleCov::SourceFile::Line
30
+ end
31
+ end
35
32
 
36
- it "returns lines number 2, 3, 4, 7 for covered_lines" do
37
- expect(subject.covered_lines.map(&:line)).to eq([2, 3, 4, 7])
38
- end
33
+ it "has 'class Foo' as line(2).source" do
34
+ expect(subject.line(2).source).to eq("class Foo\n")
35
+ end
39
36
 
40
- it "returns lines number 8 for missed_lines" do
41
- expect(subject.missed_lines.map(&:line)).to eq([8])
42
- end
37
+ it "returns lines number 2, 3, 4, 7 for covered_lines" do
38
+ expect(subject.covered_lines.map(&:line)).to eq([2, 3, 4, 7])
39
+ end
43
40
 
44
- it "returns lines number 1, 5, 6, 9, 10, 11, 15, 16 for never_lines" do
45
- expect(subject.never_lines.map(&:line)).to eq([1, 5, 6, 9, 10, 11, 15, 16])
46
- end
41
+ it "returns lines number 8 for missed_lines" do
42
+ expect(subject.missed_lines.map(&:line)).to eq([8])
43
+ end
47
44
 
48
- it "returns line numbers 12, 13, 14 for skipped_lines" do
49
- expect(subject.skipped_lines.map(&:line)).to eq([12, 13, 14])
50
- end
45
+ it "returns lines number 1, 5, 6, 9, 10, 11, 15, 16 for never_lines" do
46
+ expect(subject.never_lines.map(&:line)).to eq([1, 5, 6, 9, 10, 11, 15, 16])
47
+ end
51
48
 
52
- it "has 80% covered_percent" do
53
- expect(subject.covered_percent).to eq(80.0)
54
- end
55
- end
49
+ it "returns line numbers 12, 13, 14 for skipped_lines" do
50
+ expect(subject.skipped_lines.map(&:line)).to eq([12, 13, 14])
51
+ end
56
52
 
57
- context "simulating potential Ruby 1.9 defect -- see Issue #56" do
58
- subject do
59
- SimpleCov::SourceFile.new(source_fixture("sample.rb"), COVERAGE_FOR_SAMPLE_RB + [nil])
53
+ it "has 80% covered_percent" do
54
+ expect(subject.covered_percent).to eq(80.0)
55
+ end
60
56
  end
61
57
 
62
- it "has 16 source lines regardless of extra data in coverage array" do
63
- # Do not litter test output with known warning
64
- capture_stderr { expect(subject.lines.count).to eq(16) }
65
- end
58
+ context "simulating potential Ruby 1.9 defect -- see Issue #56" do
59
+ subject do
60
+ SimpleCov::SourceFile.new(source_fixture("sample.rb"), COVERAGE_FOR_SAMPLE_RB + [nil])
61
+ end
66
62
 
67
- it "prints a warning to stderr if coverage array contains more data than lines in the file" do
68
- captured_output = capture_stderr do
69
- subject.lines
63
+ it "has 16 source lines regardless of extra data in coverage array" do
64
+ # Do not litter test output with known warning
65
+ capture_stderr { expect(subject.lines.count).to eq(16) }
70
66
  end
71
67
 
72
- expect(captured_output).to match(/^Warning: coverage data provided/)
68
+ it "prints a warning to stderr if coverage array contains more data than lines in the file" do
69
+ captured_output = capture_stderr do
70
+ subject.lines
71
+ end
72
+
73
+ expect(captured_output).to match(/^Warning: coverage data provided/)
74
+ end
73
75
  end
74
76
  end
75
- end if SimpleCov.usable?
77
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simplecov
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.0
4
+ version: 0.13.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christoph Olszowka
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-02 00:00:00.000000000 Z
11
+ date: 2017-01-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -215,87 +215,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
215
215
  version: '0'
216
216
  requirements: []
217
217
  rubyforge_project:
218
- rubygems_version: 2.5.1
218
+ rubygems_version: 2.6.10
219
219
  signing_key:
220
220
  specification_version: 4
221
221
  summary: Code coverage for Ruby 1.9+ with a powerful configuration library and automatic
222
222
  merging of coverage across test suites
223
- test_files:
224
- - features/config_autoload.feature
225
- - features/config_command_name.feature
226
- - features/config_coverage_dir.feature
227
- - features/config_deactivate_merging.feature
228
- - features/config_formatters.feature
229
- - features/config_merge_timeout.feature
230
- - features/config_nocov_token.feature
231
- - features/config_profiles.feature
232
- - features/config_project_name.feature
233
- - features/config_styles.feature
234
- - features/config_tracked_files.feature
235
- - features/cucumber_basic.feature
236
- - features/maximum_coverage_drop.feature
237
- - features/merging_test_unit_and_rspec.feature
238
- - features/minimum_coverage.feature
239
- - features/refuse_coverage_drop.feature
240
- - features/rspec_basic.feature
241
- - features/rspec_fails_on_initialization.feature
242
- - features/rspec_groups_and_filters_basic.feature
243
- - features/rspec_groups_and_filters_complex.feature
244
- - features/rspec_groups_using_filter_class.feature
245
- - features/rspec_without_simplecov.feature
246
- - features/skipping_code_blocks_manually.feature
247
- - features/step_definitions/html_steps.rb
248
- - features/step_definitions/simplecov_steps.rb
249
- - features/step_definitions/transformers.rb
250
- - features/step_definitions/web_steps.rb
251
- - features/support/env.rb
252
- - features/test_unit_basic.feature
253
- - features/test_unit_groups_and_filters_basic.feature
254
- - features/test_unit_groups_and_filters_complex.feature
255
- - features/test_unit_groups_using_filter_class.feature
256
- - features/test_unit_without_simplecov.feature
257
- - features/unicode_compatiblity.feature
258
- - spec/1_8_fallbacks_spec.rb
259
- - spec/command_guesser_spec.rb
260
- - spec/deleted_source_spec.rb
261
- - spec/faked_project/Gemfile
262
- - spec/faked_project/Rakefile
263
- - spec/faked_project/cucumber.yml
264
- - spec/faked_project/features/step_definitions/my_steps.rb
265
- - spec/faked_project/features/support/env.rb
266
- - spec/faked_project/features/test_stuff.feature
267
- - spec/faked_project/lib/faked_project.rb
268
- - spec/faked_project/lib/faked_project/framework_specific.rb
269
- - spec/faked_project/lib/faked_project/meta_magic.rb
270
- - spec/faked_project/lib/faked_project/some_class.rb
271
- - spec/faked_project/lib/faked_project/untested_class.rb
272
- - spec/faked_project/spec/faked_spec.rb
273
- - spec/faked_project/spec/forking_spec.rb
274
- - spec/faked_project/spec/meta_magic_spec.rb
275
- - spec/faked_project/spec/some_class_spec.rb
276
- - spec/faked_project/spec/spec_helper.rb
277
- - spec/faked_project/test/faked_test.rb
278
- - spec/faked_project/test/meta_magic_test.rb
279
- - spec/faked_project/test/some_class_test.rb
280
- - spec/faked_project/test/test_helper.rb
281
- - spec/file_list_spec.rb
282
- - spec/filters_spec.rb
283
- - spec/fixtures/app/controllers/sample_controller.rb
284
- - spec/fixtures/app/models/user.rb
285
- - spec/fixtures/deleted_source_sample.rb
286
- - spec/fixtures/frameworks/rspec_bad.rb
287
- - spec/fixtures/frameworks/rspec_good.rb
288
- - spec/fixtures/frameworks/testunit_bad.rb
289
- - spec/fixtures/frameworks/testunit_good.rb
290
- - spec/fixtures/iso-8859.rb
291
- - spec/fixtures/resultset1.rb
292
- - spec/fixtures/resultset2.rb
293
- - spec/fixtures/sample.rb
294
- - spec/fixtures/utf-8.rb
295
- - spec/helper.rb
296
- - spec/merge_helpers_spec.rb
297
- - spec/multi_formatter_spec.rb
298
- - spec/result_spec.rb
299
- - spec/return_codes_spec.rb
300
- - spec/source_file_line_spec.rb
301
- - spec/source_file_spec.rb
223
+ test_files: []