simplecov 0.11.2 → 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.
- checksums.yaml +4 -4
- data/.rubocop.yml +11 -0
- data/.travis.yml +9 -4
- data/CHANGELOG.md +21 -1
- data/Gemfile +17 -13
- data/README.md +3 -16
- data/Rakefile +9 -4
- data/features/step_definitions/simplecov_steps.rb +1 -1
- data/features/support/env.rb +1 -1
- data/lib/simplecov/configuration.rb +4 -4
- data/lib/simplecov/defaults.rb +1 -1
- data/lib/simplecov/filter.rb +1 -1
- data/lib/simplecov/merge_helpers.rb +11 -9
- data/lib/simplecov/profiles.rb +2 -2
- data/lib/simplecov/result.rb +6 -1
- data/lib/simplecov/source_file.rb +11 -7
- data/lib/simplecov/version.rb +2 -2
- data/lib/simplecov.rb +5 -4
- data/simplecov.gemspec +1 -1
- data/spec/1_8_fallbacks_spec.rb +19 -17
- data/spec/command_guesser_spec.rb +40 -38
- data/spec/faked_project/lib/faked_project/some_class.rb +1 -1
- data/spec/faked_project/spec/forking_spec.rb +2 -1
- data/spec/file_list_spec.rb +48 -46
- data/spec/filters_spec.rb +73 -71
- data/spec/fixtures/deleted_source_sample.rb +1 -1
- data/spec/merge_helpers_spec.rb +96 -78
- data/spec/result_spec.rb +152 -150
- data/spec/return_codes_spec.rb +5 -8
- data/spec/source_file_line_spec.rb +109 -107
- data/spec/source_file_spec.rb +56 -54
- metadata +11 -5
data/spec/source_file_spec.rb
CHANGED
|
@@ -1,75 +1,77 @@
|
|
|
1
1
|
require "helper"
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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
|
-
|
|
15
|
-
|
|
16
|
-
|
|
11
|
+
it "has a filename" do
|
|
12
|
+
expect(subject.filename).not_to be_nil
|
|
13
|
+
end
|
|
17
14
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
15
|
+
it "has source equal to src" do
|
|
16
|
+
expect(subject.src).to eq(subject.source)
|
|
17
|
+
end
|
|
21
18
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
19
|
+
it "has source_lines equal to lines" do
|
|
20
|
+
expect(subject.lines).to eq(subject.source_lines)
|
|
21
|
+
end
|
|
25
22
|
|
|
26
|
-
|
|
27
|
-
|
|
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
|
-
|
|
33
|
-
|
|
34
|
-
|
|
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
|
-
|
|
37
|
-
|
|
38
|
-
|
|
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
|
-
|
|
41
|
-
|
|
42
|
-
|
|
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
|
-
|
|
45
|
-
|
|
46
|
-
|
|
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
|
-
|
|
49
|
-
|
|
50
|
-
|
|
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
|
-
|
|
53
|
-
|
|
54
|
-
|
|
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
|
-
|
|
58
|
-
|
|
59
|
-
|
|
53
|
+
it "has 80% covered_percent" do
|
|
54
|
+
expect(subject.covered_percent).to eq(80.0)
|
|
55
|
+
end
|
|
60
56
|
end
|
|
61
57
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
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
|
-
|
|
68
|
-
|
|
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
|
-
|
|
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
|
|
77
|
+
end
|
metadata
CHANGED
|
@@ -1,29 +1,35 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: simplecov
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 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:
|
|
11
|
+
date: 2017-01-25 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: json
|
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
|
16
16
|
requirements:
|
|
17
|
-
- - "
|
|
17
|
+
- - ">="
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
19
|
version: '1.8'
|
|
20
|
+
- - "<"
|
|
21
|
+
- !ruby/object:Gem::Version
|
|
22
|
+
version: '3'
|
|
20
23
|
type: :runtime
|
|
21
24
|
prerelease: false
|
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
26
|
requirements:
|
|
24
|
-
- - "
|
|
27
|
+
- - ">="
|
|
25
28
|
- !ruby/object:Gem::Version
|
|
26
29
|
version: '1.8'
|
|
30
|
+
- - "<"
|
|
31
|
+
- !ruby/object:Gem::Version
|
|
32
|
+
version: '3'
|
|
27
33
|
- !ruby/object:Gem::Dependency
|
|
28
34
|
name: simplecov-html
|
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -209,7 +215,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
209
215
|
version: '0'
|
|
210
216
|
requirements: []
|
|
211
217
|
rubyforge_project:
|
|
212
|
-
rubygems_version: 2.
|
|
218
|
+
rubygems_version: 2.6.10
|
|
213
219
|
signing_key:
|
|
214
220
|
specification_version: 4
|
|
215
221
|
summary: Code coverage for Ruby 1.9+ with a powerful configuration library and automatic
|