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/result_spec.rb
CHANGED
|
@@ -1,207 +1,209 @@
|
|
|
1
1
|
require "helper"
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
after do
|
|
15
|
-
SimpleCov.filters = @prev_filters
|
|
16
|
-
SimpleCov.groups = @prev_groups
|
|
17
|
-
SimpleCov.formatter = @prev_formatter
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
let(:original_result) do
|
|
21
|
-
{
|
|
22
|
-
source_fixture("sample.rb") => [nil, 1, 1, 1, nil, nil, 1, 1, nil, nil],
|
|
23
|
-
source_fixture("app/models/user.rb") => [nil, 1, 1, 1, nil, nil, 1, 0, nil, nil],
|
|
24
|
-
source_fixture("app/controllers/sample_controller.rb") => [nil, 1, 1, 1, nil, nil, 1, 0, nil, nil],
|
|
25
|
-
}
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
context "a simple cov result initialized from that" do
|
|
29
|
-
subject { SimpleCov::Result.new(original_result) }
|
|
30
|
-
|
|
31
|
-
it "has 3 filenames" do
|
|
32
|
-
expect(subject.filenames.count).to eq(3)
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
it "has 3 source files" do
|
|
36
|
-
expect(subject.source_files.count).to eq(3)
|
|
37
|
-
subject.source_files.each do |source_file|
|
|
38
|
-
expect(source_file).to be_a SimpleCov::SourceFile
|
|
39
|
-
end
|
|
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
|
|
40
13
|
end
|
|
41
14
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
15
|
+
after do
|
|
16
|
+
SimpleCov.filters = @prev_filters
|
|
17
|
+
SimpleCov.groups = @prev_groups
|
|
18
|
+
SimpleCov.formatter = @prev_formatter
|
|
45
19
|
end
|
|
46
20
|
|
|
47
|
-
|
|
48
|
-
|
|
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
|
+
}
|
|
49
27
|
end
|
|
50
28
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
expect(subject.covered_percent).to eq(86.66666666666667)
|
|
54
|
-
end
|
|
29
|
+
context "a simple cov result initialized from that" do
|
|
30
|
+
subject { SimpleCov::Result.new(original_result) }
|
|
55
31
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
32
|
+
it "has 3 filenames" do
|
|
33
|
+
expect(subject.filenames.count).to eq(3)
|
|
34
|
+
end
|
|
59
35
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
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
|
|
63
42
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
expect(subject).to
|
|
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
|
|
67
46
|
end
|
|
68
|
-
end
|
|
69
47
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
expect(subject.to_hash).to be_a Hash
|
|
48
|
+
it "has files equal to source_files" do
|
|
49
|
+
expect(subject.files).to eq(subject.source_files)
|
|
73
50
|
end
|
|
74
51
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
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
|
|
79
56
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
57
|
+
it "has accurate covered percentages" do
|
|
58
|
+
expect(subject.covered_percentages).to eq([80.0, 80.0, 100.0])
|
|
59
|
+
end
|
|
83
60
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
61
|
+
it "has accurate least covered file" do
|
|
62
|
+
expect(subject.least_covered_file).to match(/sample_controller.rb/)
|
|
63
|
+
end
|
|
87
64
|
|
|
88
|
-
|
|
89
|
-
|
|
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)
|
|
90
68
|
end
|
|
69
|
+
end
|
|
91
70
|
|
|
92
|
-
|
|
93
|
-
|
|
71
|
+
context "dumped with to_hash" do
|
|
72
|
+
it "is a hash" do
|
|
73
|
+
expect(subject.to_hash).to be_a Hash
|
|
94
74
|
end
|
|
95
75
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
76
|
+
context "loaded back with from_hash" do
|
|
77
|
+
let(:dumped_result) do
|
|
78
|
+
SimpleCov::Result.from_hash(subject.to_hash)
|
|
79
|
+
end
|
|
99
80
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
end
|
|
104
|
-
end
|
|
105
|
-
end
|
|
81
|
+
it "has 3 source files" do
|
|
82
|
+
expect(dumped_result.source_files.count).to eq(subject.source_files.count)
|
|
83
|
+
end
|
|
106
84
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
end
|
|
85
|
+
it "has the same covered_percent" do
|
|
86
|
+
expect(dumped_result.covered_percent).to eq(subject.covered_percent)
|
|
87
|
+
end
|
|
111
88
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
89
|
+
it "has the same covered_percentages" do
|
|
90
|
+
expect(dumped_result.covered_percentages).to eq(subject.covered_percentages)
|
|
91
|
+
end
|
|
115
92
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
93
|
+
it "has the same timestamp" do
|
|
94
|
+
expect(dumped_result.created_at.to_i).to eq(subject.created_at.to_i)
|
|
95
|
+
end
|
|
119
96
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
end
|
|
97
|
+
it "has the same command_name" do
|
|
98
|
+
expect(dumped_result.command_name).to eq(subject.command_name)
|
|
99
|
+
end
|
|
124
100
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
SimpleCov.add_group "Other" do |src_file|
|
|
130
|
-
File.basename(src_file.filename) == "sample.rb"
|
|
101
|
+
it "has the same original_result" do
|
|
102
|
+
expect(dumped_result.original_result).to eq(subject.original_result)
|
|
103
|
+
end
|
|
104
|
+
end
|
|
131
105
|
end
|
|
132
106
|
end
|
|
133
107
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
108
|
+
context "with some filters set up" do
|
|
109
|
+
before do
|
|
110
|
+
SimpleCov.add_filter "sample.rb"
|
|
111
|
+
end
|
|
137
112
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
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
|
|
141
116
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
117
|
+
it "has 80 covered percent" do
|
|
118
|
+
expect(SimpleCov::Result.new(original_result).covered_percent).to eq(80)
|
|
119
|
+
end
|
|
145
120
|
|
|
146
|
-
|
|
147
|
-
|
|
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
|
|
148
124
|
end
|
|
149
125
|
|
|
150
|
-
context "
|
|
126
|
+
context "with groups set up for all files" do
|
|
151
127
|
before do
|
|
152
|
-
SimpleCov.
|
|
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
|
|
153
133
|
end
|
|
154
134
|
|
|
155
|
-
|
|
156
|
-
|
|
135
|
+
subject do
|
|
136
|
+
SimpleCov::Result.new(original_result)
|
|
157
137
|
end
|
|
158
|
-
end
|
|
159
138
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
SimpleCov.formatters = [
|
|
163
|
-
SimpleCov::Formatter::SimpleFormatter,
|
|
164
|
-
SimpleCov::Formatter::SimpleFormatter,
|
|
165
|
-
]
|
|
139
|
+
it "has 3 groups" do
|
|
140
|
+
expect(subject.groups.length).to eq(3)
|
|
166
141
|
end
|
|
167
142
|
|
|
168
|
-
it "
|
|
169
|
-
|
|
170
|
-
expect(formatted.count).to eq(2)
|
|
171
|
-
expect(formatted.first).to be_a String
|
|
143
|
+
it "has user.rb in 'Models' group" do
|
|
144
|
+
expect(File.basename(subject.groups["Models"].first.filename)).to eq("user.rb")
|
|
172
145
|
end
|
|
173
|
-
end
|
|
174
|
-
end
|
|
175
146
|
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
SimpleCov.configure do
|
|
179
|
-
add_group "Models", "app/models"
|
|
180
|
-
add_group "Controllers", "app/controllers"
|
|
147
|
+
it "has sample_controller.rb in 'Controllers' group" do
|
|
148
|
+
expect(File.basename(subject.groups["Controllers"].first.filename)).to eq("sample_controller.rb")
|
|
181
149
|
end
|
|
182
|
-
end
|
|
183
150
|
|
|
184
|
-
|
|
151
|
+
context "and simple formatter being used" do
|
|
152
|
+
before do
|
|
153
|
+
SimpleCov.formatter = SimpleCov::Formatter::SimpleFormatter
|
|
154
|
+
end
|
|
185
155
|
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
156
|
+
it "returns a formatted string with result.format!" do
|
|
157
|
+
expect(subject.format!).to be_a String
|
|
158
|
+
end
|
|
159
|
+
end
|
|
189
160
|
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
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
|
|
193
174
|
end
|
|
194
175
|
end
|
|
195
176
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
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
|
|
199
184
|
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
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
|
|
203
205
|
end
|
|
204
206
|
end
|
|
205
207
|
end
|
|
206
208
|
end
|
|
207
|
-
end
|
|
209
|
+
end
|
data/spec/return_codes_spec.rb
CHANGED
|
@@ -4,14 +4,11 @@ require "helper"
|
|
|
4
4
|
# See https://github.com/colszowka/simplecov/issues/5
|
|
5
5
|
describe "return codes" do
|
|
6
6
|
context "inside fixtures/frameworks" do
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
after do
|
|
14
|
-
Dir.chdir(@current_dir)
|
|
7
|
+
around do |test|
|
|
8
|
+
Dir.chdir(File.join(File.dirname(__FILE__), "fixtures", "frameworks")) do
|
|
9
|
+
FileUtils.rm_rf("./coverage")
|
|
10
|
+
test.call
|
|
11
|
+
end
|
|
15
12
|
end
|
|
16
13
|
|
|
17
14
|
it "has return code 0 when running testunit_good.rb" do
|
|
@@ -1,38 +1,70 @@
|
|
|
1
1
|
require "helper"
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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
|
-
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
it 'returns "# the ruby source" as src' do
|
|
11
|
+
expect(subject.src).to eq("# the ruby source")
|
|
12
|
+
end
|
|
12
13
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
it "returns the same for source as for src" do
|
|
15
|
+
expect(subject.src).to eq(subject.source)
|
|
16
|
+
end
|
|
16
17
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
it "has line number 5" do
|
|
19
|
+
expect(subject.line_number).to eq(5)
|
|
20
|
+
end
|
|
20
21
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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 "
|
|
27
|
-
|
|
28
|
-
|
|
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
|
-
|
|
31
|
-
|
|
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).
|
|
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
|
|
47
|
-
expect(subject.status).to eq("
|
|
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
|
-
|
|
58
|
-
|
|
59
|
-
|
|
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
|
-
|
|
74
|
-
|
|
75
|
-
|
|
88
|
+
it "has coverage of 0" do
|
|
89
|
+
expect(subject.coverage).to be_zero
|
|
90
|
+
end
|
|
76
91
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
end
|
|
92
|
+
it "is not covered" do
|
|
93
|
+
expect(subject).not_to be_covered
|
|
94
|
+
end
|
|
81
95
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
end
|
|
96
|
+
it "is not skipped" do
|
|
97
|
+
expect(subject).not_to be_skipped
|
|
98
|
+
end
|
|
86
99
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
100
|
+
it "is missed" do
|
|
101
|
+
expect(subject).to be_missed
|
|
102
|
+
end
|
|
90
103
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
104
|
+
it "is not never" do
|
|
105
|
+
expect(subject).not_to be_never
|
|
106
|
+
end
|
|
94
107
|
|
|
95
|
-
|
|
96
|
-
|
|
108
|
+
it "status is missed" do
|
|
109
|
+
expect(subject.status).to eq("missed")
|
|
110
|
+
end
|
|
97
111
|
end
|
|
98
112
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
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
|
-
|
|
104
|
-
|
|
105
|
-
|
|
118
|
+
it "has nil coverage" do
|
|
119
|
+
expect(subject.coverage).to be_nil
|
|
120
|
+
end
|
|
106
121
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
end
|
|
122
|
+
it "is not covered" do
|
|
123
|
+
expect(subject).not_to be_covered
|
|
124
|
+
end
|
|
111
125
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
end
|
|
126
|
+
it "is not skipped" do
|
|
127
|
+
expect(subject).not_to be_skipped
|
|
128
|
+
end
|
|
116
129
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
130
|
+
it "is not missed" do
|
|
131
|
+
expect(subject).not_to be_missed
|
|
132
|
+
end
|
|
120
133
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
134
|
+
it "is never" do
|
|
135
|
+
expect(subject).to be_never
|
|
136
|
+
end
|
|
124
137
|
|
|
125
|
-
|
|
126
|
-
|
|
138
|
+
it "status is never" do
|
|
139
|
+
expect(subject.status).to eq("never")
|
|
140
|
+
end
|
|
127
141
|
end
|
|
128
142
|
|
|
129
|
-
it "
|
|
130
|
-
expect(
|
|
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 "
|
|
134
|
-
expect(
|
|
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 "
|
|
138
|
-
expect(
|
|
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
|