coveralls_reborn 0.27.0 → 0.28.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,472 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spec_helper'
4
-
5
- describe Coveralls::Configuration do
6
- before do
7
- allow(ENV).to receive(:[]).and_return(nil)
8
- end
9
-
10
- describe '.configuration' do
11
- it 'returns a hash with the default keys' do
12
- config = described_class.configuration
13
- expect(config).to be_a(Hash)
14
- expect(config.keys).to include(:environment)
15
- expect(config.keys).to include(:git)
16
- end
17
-
18
- context 'with yaml_config' do
19
- let(:repo_token) { SecureRandom.hex(4) }
20
- let(:repo_secret_token) { SecureRandom.hex(4) }
21
- let(:yaml_config) do
22
- {
23
- 'repo_token' => repo_token,
24
- 'repo_secret_token' => repo_secret_token
25
- }
26
- end
27
-
28
- before do
29
- allow(File).to receive(:exist?).with(described_class.configuration_path).and_return(true)
30
- allow(YAML).to receive(:load_file).with(described_class.configuration_path).and_return(yaml_config)
31
- end
32
-
33
- it 'sets the Yaml config and associated variables if present' do
34
- config = described_class.configuration
35
- expect(config[:configuration]).to eq(yaml_config)
36
- expect(config[:repo_token]).to eq(repo_token)
37
- end
38
-
39
- it 'uses the repo_secret_token if the repo_token is not set' do
40
- yaml_config.delete('repo_token')
41
- config = described_class.configuration
42
- expect(config[:configuration]).to eq(yaml_config)
43
- expect(config[:repo_token]).to eq(repo_secret_token)
44
- end
45
- end
46
-
47
- context 'when repo_token is in environment' do
48
- let(:repo_token) { SecureRandom.hex(4) }
49
-
50
- before do
51
- allow(ENV).to receive(:[]).with('COVERALLS_REPO_TOKEN').and_return(repo_token)
52
- end
53
-
54
- it 'pulls the repo token from the environment if set' do
55
- config = described_class.configuration
56
- expect(config[:repo_token]).to eq(repo_token)
57
- end
58
- end
59
-
60
- context 'when parallel is in environment' do
61
- before do
62
- allow(ENV).to receive(:[]).with('COVERALLS_PARALLEL').and_return(true)
63
- end
64
-
65
- it 'sets parallel to true if present' do
66
- config = described_class.configuration
67
- expect(config[:parallel]).to be true
68
- end
69
- end
70
-
71
- context 'when flag_name is in environment' do
72
- before do
73
- allow(ENV).to receive(:[]).with('COVERALLS_FLAG_NAME').and_return(true)
74
- end
75
-
76
- it 'sets flag_name to true if present' do
77
- config = described_class.configuration
78
- expect(config[:flag_name]).to be true
79
- end
80
- end
81
-
82
- context 'with services' do
83
- def services
84
- {
85
- appveyor: 'APPVEYOR',
86
- circleci: 'CIRCLECI',
87
- gitlab: 'GITLAB_CI',
88
- buildkite: 'BUILDKITE',
89
- jenkins: 'JENKINS_URL',
90
- semaphore: 'SEMAPHORE',
91
- tddium: 'TDDIUM',
92
- travis: 'TRAVIS',
93
- coveralls_local: 'COVERALLS_RUN_LOCALLY',
94
- generic: 'CI_NAME'
95
- }
96
- end
97
-
98
- shared_examples 'a service' do |service_name|
99
- let(:service_variable) { options[:service_variable] }
100
-
101
- before do
102
- allow(ENV).to receive(:[]).with(services[service_name]).and_return('1')
103
- described_class.configuration
104
- end
105
-
106
- it 'sets service parameters for this service and no other' do
107
- services.each_key.reject { |service| service == service_name }.each do |service|
108
- expect(described_class).not_to have_received(:"define_service_params_for_#{service}")
109
- end
110
-
111
- expect(described_class).to have_received(:"define_service_params_for_#{service_name}") unless service_name == :generic
112
- expect(described_class).to have_received(:define_standard_service_params_for_generic_ci)
113
- end
114
- end
115
-
116
- before do
117
- services.each_key do |service|
118
- allow(described_class).to receive(:"define_service_params_for_#{service}")
119
- end
120
-
121
- allow(described_class).to receive(:define_standard_service_params_for_generic_ci)
122
- end
123
-
124
- context 'with env based service name' do
125
- let(:service_name) { 'travis-enterprise' }
126
-
127
- before do
128
- allow(ENV).to receive(:[]).with('TRAVIS').and_return('1')
129
- allow(ENV).to receive(:[]).with('COVERALLS_SERVICE_NAME').and_return(service_name)
130
- end
131
-
132
- it 'pulls the service name from the environment if set' do
133
- config = described_class.configuration
134
- expect(config[:service_name]).to eq(service_name)
135
- end
136
- end
137
-
138
- context 'when using AppVeyor' do
139
- it_behaves_like 'a service', :appveyor
140
- end
141
-
142
- context 'when using CircleCI' do
143
- it_behaves_like 'a service', :circleci
144
- end
145
-
146
- context 'when using GitLab CI' do
147
- it_behaves_like 'a service', :gitlab
148
- end
149
-
150
- context 'when using Buildkite' do
151
- it_behaves_like 'a service', :buildkite
152
- end
153
-
154
- context 'when using Jenkins' do
155
- it_behaves_like 'a service', :jenkins
156
- end
157
-
158
- context 'when using Semaphore' do
159
- it_behaves_like 'a service', :semaphore
160
- end
161
-
162
- context 'when using Tddium' do
163
- it_behaves_like 'a service', :tddium
164
- end
165
-
166
- context 'when using Travis' do
167
- it_behaves_like 'a service', :travis
168
- end
169
-
170
- context 'when running Coveralls locally' do
171
- it_behaves_like 'a service', :coveralls_local
172
- end
173
-
174
- context 'when using a generic CI' do
175
- it_behaves_like 'a service', :generic
176
- end
177
- end
178
- end
179
-
180
- describe '.define_service_params_for_travis' do
181
- let(:travis_job_id) { SecureRandom.hex(4) }
182
-
183
- before do
184
- allow(ENV).to receive(:[]).with('TRAVIS_JOB_ID').and_return(travis_job_id)
185
- end
186
-
187
- it 'sets the service_job_id' do
188
- config = {}
189
- described_class.define_service_params_for_travis(config, nil)
190
- expect(config[:service_job_id]).to eq(travis_job_id)
191
- end
192
-
193
- it 'sets the service_name to travis-ci by default' do
194
- config = {}
195
- described_class.define_service_params_for_travis(config, nil)
196
- expect(config[:service_name]).to eq('travis-ci')
197
- end
198
-
199
- it 'sets the service_name to a value if one is passed in' do
200
- config = {}
201
- random_name = SecureRandom.hex(4)
202
- described_class.define_service_params_for_travis(config, random_name)
203
- expect(config[:service_name]).to eq(random_name)
204
- end
205
- end
206
-
207
- describe '.define_service_params_for_circleci' do
208
- let(:circle_workflow_id) { 1234 }
209
- let(:ci_pull_request) { 'repo/pull/12' }
210
- let(:circle_build_num) { SecureRandom.hex(4) }
211
- let(:circle_sha1) { SecureRandom.hex(32) }
212
- let(:circle_branch) { SecureRandom.hex(4) }
213
-
214
- before do
215
- allow(ENV).to receive(:[]).with('CIRCLE_WORKFLOW_ID').and_return(circle_workflow_id)
216
- allow(ENV).to receive(:[]).with('CI_PULL_REQUEST').and_return(ci_pull_request)
217
- allow(ENV).to receive(:[]).with('CIRCLE_BUILD_NUM').and_return(circle_build_num)
218
- allow(ENV).to receive(:[]).with('CIRCLE_SHA1').and_return(circle_sha1)
219
- allow(ENV).to receive(:[]).with('CIRCLE_BRANCH').and_return(circle_branch)
220
- end
221
-
222
- it 'sets the expected parameters' do
223
- config = {}
224
- described_class.define_service_params_for_circleci(config)
225
- expect(config).to include(
226
- service_name: 'circleci',
227
- service_number: circle_workflow_id,
228
- service_pull_request: '12',
229
- service_job_number: circle_build_num,
230
- git_commit: circle_sha1,
231
- git_branch: circle_branch
232
- )
233
- end
234
- end
235
-
236
- describe '.define_service_params_for_gitlab' do
237
- let(:commit_sha) { SecureRandom.hex(32) }
238
- let(:service_job_number) { 'spec:one' }
239
- let(:service_job_id) { 1234 }
240
- let(:service_branch) { 'feature' }
241
- let(:service_number) { 5678 }
242
-
243
- before do
244
- allow(ENV).to receive(:[]).with('CI_BUILD_NAME').and_return(service_job_number)
245
- allow(ENV).to receive(:[]).with('CI_PIPELINE_ID').and_return(service_number)
246
- allow(ENV).to receive(:[]).with('CI_BUILD_ID').and_return(service_job_id)
247
- allow(ENV).to receive(:[]).with('CI_BUILD_REF_NAME').and_return(service_branch)
248
- allow(ENV).to receive(:[]).with('CI_BUILD_REF').and_return(commit_sha)
249
- end
250
-
251
- it 'sets the expected parameters' do
252
- config = {}
253
- described_class.define_service_params_for_gitlab(config)
254
- expect(config).to include(
255
- service_name: 'gitlab-ci',
256
- service_number: service_number,
257
- service_job_number: service_job_number,
258
- service_job_id: service_job_id,
259
- service_branch: service_branch,
260
- commit_sha: commit_sha
261
- )
262
- end
263
- end
264
-
265
- describe '.define_service_params_for_buildkite' do
266
- let(:service_number) { 5678 }
267
- let(:service_job_id) { 1234 }
268
- let(:service_branch) { 'feature' }
269
- let(:service_build_url) { SecureRandom.hex(4) }
270
- let(:service_pull_request) { SecureRandom.hex(4) }
271
- let(:commit_sha) { SecureRandom.hex(32) }
272
-
273
- before do
274
- allow(ENV).to receive(:[]).with('BUILDKITE_BUILD_NUMBER').and_return(service_number)
275
- allow(ENV).to receive(:[]).with('BUILDKITE_BUILD_ID').and_return(service_job_id)
276
- allow(ENV).to receive(:[]).with('BUILDKITE_BRANCH').and_return(service_branch)
277
- allow(ENV).to receive(:[]).with('BUILDKITE_BUILD_URL').and_return(service_build_url)
278
- allow(ENV).to receive(:[]).with('BUILDKITE_PULL_REQUEST').and_return(service_pull_request)
279
- allow(ENV).to receive(:[]).with('BUILDKITE_COMMIT').and_return(commit_sha)
280
- end
281
-
282
- it 'sets the expected parameters' do
283
- config = {}
284
- described_class.define_service_params_for_buildkite(config)
285
- expect(config).to include(
286
- service_name: 'buildkite',
287
- service_number: service_number,
288
- service_job_id: service_job_id,
289
- service_branch: service_branch,
290
- service_build_url: service_build_url,
291
- service_pull_request: service_pull_request,
292
- commit_sha: commit_sha
293
- )
294
- end
295
- end
296
-
297
- describe '.define_service_params_for_semaphore' do
298
- let(:semaphore_workflow_id) { 1234 }
299
- let(:semaphore_git_pr_number) { 10 }
300
- let(:semaphore_git_working_branch) { 'pr-branch' }
301
- let(:semaphore_job_id) { 5678 }
302
- let(:semaphore_organization_url) { 'an-organization' }
303
-
304
- before do
305
- allow(ENV).to receive(:[]).with('SEMAPHORE_WORKFLOW_ID').and_return(semaphore_workflow_id)
306
- allow(ENV).to receive(:[]).with('SEMAPHORE_GIT_PR_NUMBER').and_return(semaphore_git_pr_number)
307
- allow(ENV).to receive(:[]).with('SEMAPHORE_GIT_WORKING_BRANCH').and_return(semaphore_git_working_branch)
308
- allow(ENV).to receive(:[]).with('SEMAPHORE_JOB_ID').and_return(semaphore_job_id)
309
- allow(ENV).to receive(:[]).with('SEMAPHORE_ORGANIZATION_URL').and_return(semaphore_organization_url)
310
- end
311
-
312
- it 'sets the expected parameters' do
313
- config = {}
314
- described_class.define_service_params_for_semaphore(config)
315
- expect(config).to include(
316
- service_name: 'semaphore',
317
- service_number: semaphore_workflow_id,
318
- service_job_id: semaphore_job_id,
319
- service_build_url: "#{semaphore_organization_url}/jobs/#{semaphore_job_id}",
320
- service_branch: semaphore_git_working_branch,
321
- service_pull_request: semaphore_git_pr_number
322
- )
323
- end
324
- end
325
-
326
- describe '.define_service_params_for_jenkins' do
327
- let(:service_pull_request) { '1234' }
328
- let(:build_num) { SecureRandom.hex(4) }
329
-
330
- before do
331
- allow(ENV).to receive(:[]).with('CI_PULL_REQUEST').and_return(service_pull_request)
332
- allow(ENV).to receive(:[]).with('BUILD_NUMBER').and_return(build_num)
333
- end
334
-
335
- it 'sets the expected parameters' do
336
- config = {}
337
- described_class.define_service_params_for_jenkins config
338
- described_class.define_standard_service_params_for_generic_ci config
339
- expect(config).to include(
340
- service_name: 'jenkins',
341
- service_number: build_num,
342
- service_pull_request: service_pull_request
343
- )
344
- end
345
- end
346
-
347
- describe '.define_service_params_for_coveralls_local' do
348
- it 'sets the expected parameters' do
349
- config = {}
350
- described_class.define_service_params_for_coveralls_local(config)
351
- expect(config).to include(
352
- service_name: 'coveralls-ruby',
353
- service_job_id: nil,
354
- service_event_type: 'manual'
355
- )
356
- end
357
- end
358
-
359
- describe '.define_service_params_for_generic_ci' do
360
- let(:service_name) { SecureRandom.hex(4) }
361
- let(:service_number) { SecureRandom.hex(4) }
362
- let(:service_build_url) { SecureRandom.hex(4) }
363
- let(:service_branch) { SecureRandom.hex(4) }
364
- let(:service_pull_request) { '1234' }
365
-
366
- before do
367
- allow(ENV).to receive(:[]).with('CI_NAME').and_return(service_name)
368
- allow(ENV).to receive(:[]).with('CI_BUILD_NUMBER').and_return(service_number)
369
- allow(ENV).to receive(:[]).with('CI_BUILD_URL').and_return(service_build_url)
370
- allow(ENV).to receive(:[]).with('CI_BRANCH').and_return(service_branch)
371
- allow(ENV).to receive(:[]).with('CI_PULL_REQUEST').and_return(service_pull_request)
372
- end
373
-
374
- it 'sets the expected parameters' do
375
- config = {}
376
- described_class.define_standard_service_params_for_generic_ci(config)
377
- expect(config).to include(
378
- service_name: service_name,
379
- service_number: service_number,
380
- service_build_url: service_build_url,
381
- service_branch: service_branch,
382
- service_pull_request: service_pull_request
383
- )
384
- end
385
- end
386
-
387
- describe '.define_service_params_for_appveyor' do
388
- let(:service_number) { SecureRandom.hex(4) }
389
- let(:service_branch) { SecureRandom.hex(4) }
390
- let(:commit_sha) { SecureRandom.hex(4) }
391
- let(:repo_name) { SecureRandom.hex(4) }
392
-
393
- before do
394
- allow(ENV).to receive(:[]).with('APPVEYOR_BUILD_VERSION').and_return(service_number)
395
- allow(ENV).to receive(:[]).with('APPVEYOR_REPO_BRANCH').and_return(service_branch)
396
- allow(ENV).to receive(:[]).with('APPVEYOR_REPO_COMMIT').and_return(commit_sha)
397
- allow(ENV).to receive(:[]).with('APPVEYOR_REPO_NAME').and_return(repo_name)
398
- end
399
-
400
- it 'sets the expected parameters' do
401
- config = {}
402
- described_class.define_service_params_for_appveyor(config)
403
- expect(config).to include(
404
- service_name: 'appveyor',
405
- service_number: service_number,
406
- service_branch: service_branch,
407
- commit_sha: commit_sha,
408
- service_build_url: format('https://ci.appveyor.com/project/%<repo_name>s/build/%<service_number>s', repo_name: repo_name, service_number: service_number)
409
- )
410
- end
411
- end
412
-
413
- describe '.define_service_params_for_tddium' do
414
- let(:service_number) { SecureRandom.hex(4) }
415
- let(:service_job_number) { SecureRandom.hex(4) }
416
- let(:service_pull_request) { SecureRandom.hex(4) }
417
- let(:service_branch) { SecureRandom.hex(4) }
418
-
419
- before do
420
- allow(ENV).to receive(:[]).with('TDDIUM_SESSION_ID').and_return(service_number)
421
- allow(ENV).to receive(:[]).with('TDDIUM_TID').and_return(service_job_number)
422
- allow(ENV).to receive(:[]).with('TDDIUM_PR_ID').and_return(service_pull_request)
423
- allow(ENV).to receive(:[]).with('TDDIUM_CURRENT_BRANCH').and_return(service_branch)
424
- end
425
-
426
- it 'sets the expected parameters' do
427
- config = {}
428
- described_class.define_service_params_for_tddium(config)
429
- expect(config).to include(
430
- service_name: 'tddium',
431
- service_number: service_number,
432
- service_job_number: service_job_number,
433
- service_pull_request: service_pull_request,
434
- service_branch: service_branch,
435
- service_build_url: format('https://ci.solanolabs.com/reports/%<service_number>s', service_number: service_number)
436
- )
437
- end
438
- end
439
-
440
- describe '.git' do
441
- let(:git_id) { SecureRandom.hex(2) }
442
- let(:author_name) { SecureRandom.hex(4) }
443
- let(:author_email) { SecureRandom.hex(4) }
444
- let(:committer_name) { SecureRandom.hex(4) }
445
- let(:committer_email) { SecureRandom.hex(4) }
446
- let(:message) { SecureRandom.hex(4) }
447
- let(:branch) { SecureRandom.hex(4) }
448
-
449
- before do
450
- allow(ENV).to receive(:fetch).with('GIT_ID', anything).and_return(git_id)
451
- allow(ENV).to receive(:fetch).with('GIT_AUTHOR_NAME', anything).and_return(author_name)
452
- allow(ENV).to receive(:fetch).with('GIT_AUTHOR_EMAIL', anything).and_return(author_email)
453
- allow(ENV).to receive(:fetch).with('GIT_COMMITTER_NAME', anything).and_return(committer_name)
454
- allow(ENV).to receive(:fetch).with('GIT_COMMITTER_EMAIL', anything).and_return(committer_email)
455
- allow(ENV).to receive(:fetch).with('GIT_MESSAGE', anything).and_return(message)
456
- allow(ENV).to receive(:fetch).with('GIT_BRANCH', anything).and_return(branch)
457
- end
458
-
459
- it 'uses ENV vars' do
460
- config = described_class.git
461
- expect(config[:branch]).to eq(branch)
462
- expect(config[:head]).to include(
463
- id: git_id,
464
- author_name: author_name,
465
- author_email: author_email,
466
- committer_name: committer_name,
467
- committer_email: committer_email,
468
- message: message
469
- )
470
- end
471
- end
472
- end
@@ -1,127 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spec_helper'
4
-
5
- describe Coveralls do
6
- before do
7
- allow(SimpleCov).to receive(:start)
8
- stub_api_post
9
- described_class.testing = true
10
- end
11
-
12
- describe '#will_run?' do
13
- it 'checks CI environemnt variables' do
14
- expect(described_class).to be_will_run
15
- end
16
-
17
- context 'with CI disabled' do
18
- before do
19
- allow(ENV).to receive(:[])
20
- allow(ENV).to receive(:[]).with('COVERALLS_RUN_LOCALLY').and_return(nil)
21
- allow(ENV).to receive(:[]).with('CI').and_return(nil)
22
- described_class.testing = false
23
- end
24
-
25
- it 'indicates no run' do
26
- expect(described_class).not_to be_will_run
27
- end
28
- end
29
- end
30
-
31
- describe '#should_run?' do
32
- it 'outputs to stdout when running locally' do
33
- described_class.testing = false
34
- described_class.run_locally = true
35
-
36
- expect do
37
- silence { described_class.should_run? }
38
- end.not_to raise_error
39
- end
40
- end
41
-
42
- describe '#wear!' do
43
- it 'receives block' do
44
- silence do
45
- described_class.wear! do
46
- add_filter 's'
47
- end
48
- end
49
-
50
- expect(SimpleCov).to have_received(:start)
51
- end
52
-
53
- it 'uses string' do
54
- silence do
55
- described_class.wear! 'test_frameworks'
56
- end
57
-
58
- expect(SimpleCov).to have_received(:start).with 'test_frameworks'
59
- end
60
-
61
- it 'uses default' do
62
- silence do
63
- described_class.wear!
64
- end
65
-
66
- expect(SimpleCov).to have_received(:start).with no_args
67
- expect(SimpleCov.filters.map(&:filter_argument)).to include 'vendor'
68
- end
69
- end
70
-
71
- describe '#wear_merged!' do
72
- it 'sets formatter to NilFormatter' do
73
- silence do
74
- described_class.wear_merged! 'rails' do
75
- add_filter '/spec/'
76
- end
77
- end
78
-
79
- expect(SimpleCov.formatter).to be Coveralls::NilFormatter
80
- end
81
- end
82
-
83
- describe '#push!' do
84
- let(:coverage_hash) do
85
- { 'file.rb'=>{ 'lines'=>[nil] } }
86
- end
87
-
88
- before do
89
- allow(SimpleCov::ResultMerger).to receive(:merge_valid_results).and_return([['RSpec'], coverage_hash])
90
- end
91
-
92
- it 'sends existing test results' do
93
- result = false
94
- silence do
95
- result = described_class.push!
96
- end
97
- expect(result).to be_truthy
98
- end
99
- end
100
-
101
- describe '#setup!' do
102
- it 'sets SimpleCov adapter' do
103
- previous_adapter = described_class.adapter
104
- described_class.adapter = nil
105
-
106
- expect do
107
- silence { described_class.setup! }
108
- end.to change(described_class, :adapter).from(nil).to(:simplecov)
109
- ensure
110
- described_class.adapter = previous_adapter
111
- end
112
-
113
- context 'when SimpleCov is not defined' do
114
- # rubocop:disable RSpec/LeakyConstantDeclaration
115
- it 'tries to load it' do
116
- SimpleCovTmp = SimpleCov
117
- Object.send :remove_const, :SimpleCov
118
- expect do
119
- silence { described_class.setup! }
120
- end.not_to raise_error
121
- ensure
122
- SimpleCov = SimpleCovTmp
123
- end
124
- # rubocop:enable RSpec/LeakyConstantDeclaration
125
- end
126
- end
127
- end
@@ -1,14 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # Foo class
4
- class Foo
5
- def initialize
6
- @foo = 'baz'
7
- end
8
-
9
- # :nocov:
10
- def bar
11
- @foo
12
- end
13
- # :nocov:
14
- end
@@ -1,12 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # Foo class
4
- class Foo
5
- def initialize
6
- @foo = 'baz'
7
- end
8
-
9
- def bar
10
- @foo
11
- end
12
- 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,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,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
- def foo
12
- if @foo
13
- 'bar'
14
- end
15
- end
16
- end
@@ -1 +0,0 @@
1
- # this file should not be covered
@@ -1,12 +0,0 @@
1
- # Foo class
2
- class Foo
3
- def initialize
4
- @foo = 'baz'
5
- end
6
-
7
- # :nocov:
8
- def bar
9
- @foo
10
- end
11
- # :nocov:
12
- end