coverband 4.2.0.beta → 4.2.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +33 -8
- data/Rakefile +1 -1
- data/changes.md +28 -7
- data/coverband.gemspec +2 -0
- data/lib/coverband.rb +5 -0
- data/lib/coverband/adapters/base.rb +20 -4
- data/lib/coverband/adapters/file_store.rb +8 -0
- data/lib/coverband/adapters/redis_store.rb +33 -2
- data/lib/coverband/at_exit.rb +1 -1
- data/lib/coverband/collectors/coverage.rb +11 -1
- data/lib/coverband/configuration.rb +18 -2
- data/lib/coverband/integrations/background.rb +6 -1
- data/lib/coverband/integrations/resque.rb +7 -2
- data/lib/coverband/reporters/base.rb +8 -38
- data/lib/coverband/reporters/html_report.rb +1 -1
- data/lib/coverband/reporters/web.rb +3 -3
- data/lib/coverband/utils/file_path_helper.rb +57 -0
- data/lib/coverband/utils/html_formatter.rb +9 -1
- data/lib/coverband/utils/railtie.rb +1 -1
- data/lib/coverband/utils/tasks.rb +9 -0
- data/lib/coverband/version.rb +1 -1
- data/test/benchmarks/benchmark.rake +36 -1
- data/test/benchmarks/coverage_fork.sh +37 -0
- data/test/{unit/adapters_base_test.rb → coverband/adapters/base_test.rb} +1 -1
- data/test/{unit/adapters_file_store_test.rb → coverband/adapters/file_store_test.rb} +1 -1
- data/test/{unit/adapters_redis_store_test.rb → coverband/adapters/redis_store_test.rb} +1 -1
- data/test/{unit → coverband}/at_exit_test.rb +0 -0
- data/test/{unit/collectors_coverage_test.rb → coverband/collectors/coverage_test.rb} +16 -2
- data/test/{unit → coverband}/configuration_test.rb +13 -3
- data/test/{unit → coverband}/coverband_test.rb +0 -0
- data/test/{unit → coverband/integrations}/background_test.rb +1 -1
- data/test/{unit → coverband/integrations}/middleware_test.rb +1 -1
- data/test/{unit/rack_server_checkout_test.rb → coverband/integrations/rack_server_check_test.rb} +1 -1
- data/test/{unit → coverband/integrations}/resque_worker_test.rb +9 -8
- data/test/{unit → coverband/integrations}/test_resque_job.rb +0 -0
- data/test/coverband/reporters/base_test.rb +168 -0
- data/test/{unit/reports_console_test.rb → coverband/reporters/console_test.rb} +6 -5
- data/test/{unit/reports_html_test.rb → coverband/reporters/html_test.rb} +1 -1
- data/test/{unit/reports_web_test.rb → coverband/reporters/web_test.rb} +2 -2
- data/test/{unit → coverband}/utils/file_groups_test.rb +0 -0
- data/test/{unit → coverband}/utils/file_list_test.rb +0 -0
- data/test/{unit → coverband}/utils/gem_list_test.rb +0 -0
- data/test/{unit → coverband}/utils/lines_classifier_test.rb +0 -0
- data/test/{unit → coverband}/utils/result_test.rb +0 -0
- data/test/{unit → coverband}/utils/s3_report_test.rb +0 -0
- data/test/{unit → coverband}/utils/source_file_line_test.rb +0 -0
- data/test/{unit → coverband}/utils/source_file_test.rb +0 -0
- data/test/{unit/dog.rb → dog.rb} +0 -0
- data/test/{unit → integration}/full_stack_test.rb +4 -2
- data/test/{unit → integration}/rails_full_stack_test.rb +4 -3
- data/test/{unit → integration}/rails_gems_full_stack_test.rb +2 -1
- data/views/layout.erb +1 -1
- data/views/settings.erb +35 -0
- metadata +78 -59
- data/test/unit/reports_base_test.rb +0 -117
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require File.expand_path('
|
3
|
+
require File.expand_path('../../test_helper', File.dirname(__FILE__))
|
4
4
|
|
5
5
|
class HTMLReportTest < Minitest::Test
|
6
6
|
REDIS_STORAGE_FORMAT_VERSION = Coverband::Adapters::RedisStore::REDIS_STORAGE_FORMAT_VERSION
|
@@ -20,13 +20,14 @@ class HTMLReportTest < Minitest::Test
|
|
20
20
|
end
|
21
21
|
Coverband.configuration.logger.stubs('info')
|
22
22
|
mock_file_hash
|
23
|
-
Coverband
|
24
|
-
|
25
|
-
|
23
|
+
Coverband.configuration
|
24
|
+
.expects(:current_root)
|
25
|
+
.at_least_once
|
26
|
+
.returns('app_path')
|
26
27
|
@store.send(:save_report, basic_coverage)
|
27
28
|
|
28
29
|
report = Coverband::Reporters::ConsoleReport.report(@store)
|
29
|
-
expected = { '
|
30
|
+
expected = { './dog.rb' => [0, 1, 2] }
|
30
31
|
assert_equal(expected.keys, report.keys)
|
31
32
|
end
|
32
33
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require File.expand_path('
|
3
|
+
require File.expand_path('../../test_helper', File.dirname(__FILE__))
|
4
4
|
|
5
5
|
class ReportHTMLTest < Minitest::Test
|
6
6
|
REDIS_STORAGE_FORMAT_VERSION = Coverband::Adapters::RedisStore::REDIS_STORAGE_FORMAT_VERSION
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require File.expand_path('
|
3
|
+
require File.expand_path('../../test_helper', File.dirname(__FILE__))
|
4
4
|
require 'aws-sdk-s3'
|
5
|
-
require File.expand_path('
|
5
|
+
require File.expand_path('../../../lib/coverband/reporters/web', File.dirname(__FILE__))
|
6
6
|
require 'rack/test'
|
7
7
|
|
8
8
|
ENV['RACK_ENV'] = 'test'
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/test/{unit/dog.rb → dog.rb}
RENAMED
File without changes
|
@@ -6,6 +6,7 @@ require 'rack'
|
|
6
6
|
class FullStackTest < Minitest::Test
|
7
7
|
REDIS_STORAGE_FORMAT_VERSION = Coverband::Adapters::RedisStore::REDIS_STORAGE_FORMAT_VERSION
|
8
8
|
TEST_RACK_APP = '../fake_app/basic_rack.rb'
|
9
|
+
RELATIVE_FILE = './fake_app/basic_rack.rb'
|
9
10
|
|
10
11
|
def setup
|
11
12
|
super
|
@@ -15,6 +16,7 @@ class FullStackTest < Minitest::Test
|
|
15
16
|
config.store = Coverband::Adapters::RedisStore.new(Redis.new)
|
16
17
|
config.s3_bucket = nil
|
17
18
|
config.background_reporting_enabled = false
|
19
|
+
config.root_paths = ["#{File.expand_path('../', File.dirname(__FILE__))}/"]
|
18
20
|
end
|
19
21
|
Coverband.configuration.store.clear!
|
20
22
|
Coverband.start
|
@@ -29,13 +31,13 @@ class FullStackTest < Minitest::Test
|
|
29
31
|
assert_equal 'Hello Rack!', results.last
|
30
32
|
sleep(0.1)
|
31
33
|
expected = [nil, nil, 1, nil, 1, 1, 1, nil, nil]
|
32
|
-
assert_equal expected, Coverband.configuration.store.coverage[
|
34
|
+
assert_equal expected, Coverband.configuration.store.coverage[RELATIVE_FILE]['data']
|
33
35
|
|
34
36
|
# additional calls increase count by 1
|
35
37
|
middleware.call(request)
|
36
38
|
sleep(0.1)
|
37
39
|
expected = [nil, nil, 1, nil, 1, 1, 2, nil, nil]
|
38
|
-
assert_equal expected, Coverband.configuration.store.coverage[
|
40
|
+
assert_equal expected, Coverband.configuration.store.coverage[RELATIVE_FILE]['data']
|
39
41
|
end
|
40
42
|
|
41
43
|
test 'call app with gem tracking' do
|
@@ -10,6 +10,7 @@ class RailsFullStackTest < Minitest::Test
|
|
10
10
|
super
|
11
11
|
# The normal relative directory lookup of coverband won't work for our dummy rails project
|
12
12
|
Coverband.configure("./test/rails#{Rails::VERSION::MAJOR}_dummy/config/coverband.rb")
|
13
|
+
Coverband.configuration.background_reporting_enabled = false
|
13
14
|
Coverband.start
|
14
15
|
end
|
15
16
|
|
@@ -21,8 +22,8 @@ class RailsFullStackTest < Minitest::Test
|
|
21
22
|
|
22
23
|
test 'this is how we do it' do
|
23
24
|
visit '/dummy/show'
|
25
|
+
Coverband.report_coverage(true)
|
24
26
|
assert_content('I am no dummy')
|
25
|
-
sleep 0.2
|
26
27
|
visit '/coverage'
|
27
28
|
within page.find('a', text: /dummy_controller.rb/).find(:xpath, '../..') do
|
28
29
|
assert_selector('td', text: '100.0 %')
|
@@ -46,7 +47,7 @@ class RailsFullStackTest < Minitest::Test
|
|
46
47
|
3.times do
|
47
48
|
visit '/dummy/show'
|
48
49
|
assert_content('I am no dummy')
|
49
|
-
Coverband
|
50
|
+
Coverband.report_coverage(true)
|
50
51
|
end
|
51
52
|
|
52
53
|
previous_out = $stdout
|
@@ -57,7 +58,7 @@ class RailsFullStackTest < Minitest::Test
|
|
57
58
|
15.times do
|
58
59
|
visit '/dummy/show'
|
59
60
|
assert_content('I am no dummy')
|
60
|
-
Coverband
|
61
|
+
Coverband.report_coverage(true)
|
61
62
|
# this is expected to retain memory across requests
|
62
63
|
# clear it to remove the false positive from test
|
63
64
|
Coverband::Collectors::Coverage.instance.send(:add_previous_results, nil)
|
@@ -12,6 +12,7 @@ class RailsGemsFullStackTest < Minitest::Test
|
|
12
12
|
Coverband.configure("./test/rails#{Rails::VERSION::MAJOR}_dummy/config/coverband.rb")
|
13
13
|
Coverband.configuration.track_gems = true
|
14
14
|
Coverband.configuration.gem_details = true
|
15
|
+
Coverband.configuration.background_reporting_enabled = false
|
15
16
|
Coverband.start
|
16
17
|
require 'rainbow'
|
17
18
|
Rainbow('this text is red').red
|
@@ -26,7 +27,7 @@ class RailsGemsFullStackTest < Minitest::Test
|
|
26
27
|
test 'this is how gem it' do
|
27
28
|
visit '/dummy/show'
|
28
29
|
assert_content('I am no dummy')
|
29
|
-
|
30
|
+
Coverband.report_coverage(true)
|
30
31
|
visit '/coverage'
|
31
32
|
assert_content('Coverband Admin')
|
32
33
|
assert_content('Gems')
|
data/views/layout.erb
CHANGED
@@ -16,7 +16,7 @@
|
|
16
16
|
<div id="wrapper" style="display:none;">
|
17
17
|
<div id="header">
|
18
18
|
<a href='<%= base_path %>'>Coverband Admin</a>
|
19
|
-
<a href='<%= base_path %>settings'>
|
19
|
+
<a href='<%= base_path %>settings'>Info</a>
|
20
20
|
<%= button("#{base_path}collect_coverage", 'force coverage collection') %>
|
21
21
|
<%= button("#{base_path}reload_files", 'reload Coverband files') %>
|
22
22
|
<% if Coverband.configuration.web_enable_clear %>
|
data/views/settings.erb
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html xmlns='http://www.w3.org/1999/xhtml'>
|
3
|
+
<head>
|
4
|
+
<title>Coverband Info: <%= Coverband::VERSION %></title>
|
5
|
+
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
6
|
+
<script src='<%= assets_path('application.js') %>' type='text/javascript'></script>
|
7
|
+
<link href='<%= assets_path('application.css') %>' media='screen, projection, print' rel='stylesheet' type='text/css'>
|
8
|
+
<link rel="icon" type="image/png" href="<%= assets_path('favicon.png') %>" />
|
9
|
+
</head>
|
10
|
+
|
11
|
+
<body>
|
12
|
+
<div id="wrapper" style="">
|
13
|
+
<div id="header">
|
14
|
+
<a href='<%= base_path %>'>Coverband Admin</a>
|
15
|
+
<a href='<%= base_path %>settings'>Info</a>
|
16
|
+
</div>
|
17
|
+
<div id="content">
|
18
|
+
<dl>
|
19
|
+
<% Coverband.configuration.to_h.each_pair do |key,value| %>
|
20
|
+
<dt><%= key %></dt>
|
21
|
+
<dd><%= value %></dd>
|
22
|
+
<% end %>
|
23
|
+
|
24
|
+
<dt>Size (in bytes)</dt>
|
25
|
+
<dd><%= Coverband.configuration.store.size %></dd>
|
26
|
+
<dt>Size (in MiB)</dt>
|
27
|
+
<dd><%= Coverband.configuration.store.size_in_mib %></dd>
|
28
|
+
</dl>
|
29
|
+
</div>
|
30
|
+
<div id="footer">
|
31
|
+
Generated by <a href="http://github.com/danmayer/coverband">Coverband</a> v<%= Coverband::VERSION %>
|
32
|
+
</div>
|
33
|
+
</div>
|
34
|
+
</body>
|
35
|
+
</html>
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: coverband
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.2.0.
|
4
|
+
version: 4.2.0.rc1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dan Mayer
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2019-
|
12
|
+
date: 2019-03-13 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: aws-sdk-s3
|
@@ -207,6 +207,20 @@ dependencies:
|
|
207
207
|
- - ">="
|
208
208
|
- !ruby/object:Gem::Version
|
209
209
|
version: '0'
|
210
|
+
- !ruby/object:Gem::Dependency
|
211
|
+
name: minitest-profile
|
212
|
+
requirement: !ruby/object:Gem::Requirement
|
213
|
+
requirements:
|
214
|
+
- - ">="
|
215
|
+
- !ruby/object:Gem::Version
|
216
|
+
version: '0'
|
217
|
+
type: :development
|
218
|
+
prerelease: false
|
219
|
+
version_requirements: !ruby/object:Gem::Requirement
|
220
|
+
requirements:
|
221
|
+
- - ">="
|
222
|
+
- !ruby/object:Gem::Version
|
223
|
+
version: '0'
|
210
224
|
- !ruby/object:Gem::Dependency
|
211
225
|
name: redis
|
212
226
|
requirement: !ruby/object:Gem::Requirement
|
@@ -257,6 +271,7 @@ files:
|
|
257
271
|
- lib/coverband/reporters/web.rb
|
258
272
|
- lib/coverband/utils/file_groups.rb
|
259
273
|
- lib/coverband/utils/file_list.rb
|
274
|
+
- lib/coverband/utils/file_path_helper.rb
|
260
275
|
- lib/coverband/utils/gem_list.rb
|
261
276
|
- lib/coverband/utils/html_formatter.rb
|
262
277
|
- lib/coverband/utils/lines_classifier.rb
|
@@ -292,8 +307,34 @@ files:
|
|
292
307
|
- public/magnify.png
|
293
308
|
- test/benchmarks/.gitignore
|
294
309
|
- test/benchmarks/benchmark.rake
|
310
|
+
- test/benchmarks/coverage_fork.sh
|
295
311
|
- test/benchmarks/dog.rb
|
296
312
|
- test/benchmarks/graph_bench.sh
|
313
|
+
- test/coverband/adapters/base_test.rb
|
314
|
+
- test/coverband/adapters/file_store_test.rb
|
315
|
+
- test/coverband/adapters/redis_store_test.rb
|
316
|
+
- test/coverband/at_exit_test.rb
|
317
|
+
- test/coverband/collectors/coverage_test.rb
|
318
|
+
- test/coverband/configuration_test.rb
|
319
|
+
- test/coverband/coverband_test.rb
|
320
|
+
- test/coverband/integrations/background_test.rb
|
321
|
+
- test/coverband/integrations/middleware_test.rb
|
322
|
+
- test/coverband/integrations/rack_server_check_test.rb
|
323
|
+
- test/coverband/integrations/resque_worker_test.rb
|
324
|
+
- test/coverband/integrations/test_resque_job.rb
|
325
|
+
- test/coverband/reporters/base_test.rb
|
326
|
+
- test/coverband/reporters/console_test.rb
|
327
|
+
- test/coverband/reporters/html_test.rb
|
328
|
+
- test/coverband/reporters/web_test.rb
|
329
|
+
- test/coverband/utils/file_groups_test.rb
|
330
|
+
- test/coverband/utils/file_list_test.rb
|
331
|
+
- test/coverband/utils/gem_list_test.rb
|
332
|
+
- test/coverband/utils/lines_classifier_test.rb
|
333
|
+
- test/coverband/utils/result_test.rb
|
334
|
+
- test/coverband/utils/s3_report_test.rb
|
335
|
+
- test/coverband/utils/source_file_line_test.rb
|
336
|
+
- test/coverband/utils/source_file_test.rb
|
337
|
+
- test/dog.rb
|
297
338
|
- test/fake_app/basic_rack.rb
|
298
339
|
- test/fixtures/app/controllers/sample_controller.rb
|
299
340
|
- test/fixtures/app/models/user.rb
|
@@ -302,6 +343,9 @@ files:
|
|
302
343
|
- test/fixtures/skipped.rb
|
303
344
|
- test/fixtures/skipped_and_executed.rb
|
304
345
|
- test/fixtures/utf-8.rb
|
346
|
+
- test/integration/full_stack_test.rb
|
347
|
+
- test/integration/rails_full_stack_test.rb
|
348
|
+
- test/integration/rails_gems_full_stack_test.rb
|
305
349
|
- test/rails4_dummy/app/controllers/dummy_controller.rb
|
306
350
|
- test/rails4_dummy/config.ru
|
307
351
|
- test/rails4_dummy/config/application.rb
|
@@ -318,37 +362,10 @@ files:
|
|
318
362
|
- test/rails5_dummy/config/routes.rb
|
319
363
|
- test/rails_test_helper.rb
|
320
364
|
- test/test_helper.rb
|
321
|
-
- test/unit/adapters_base_test.rb
|
322
|
-
- test/unit/adapters_file_store_test.rb
|
323
|
-
- test/unit/adapters_redis_store_test.rb
|
324
|
-
- test/unit/at_exit_test.rb
|
325
|
-
- test/unit/background_test.rb
|
326
|
-
- test/unit/collectors_coverage_test.rb
|
327
|
-
- test/unit/configuration_test.rb
|
328
|
-
- test/unit/coverband_test.rb
|
329
|
-
- test/unit/dog.rb
|
330
|
-
- test/unit/full_stack_test.rb
|
331
|
-
- test/unit/middleware_test.rb
|
332
|
-
- test/unit/rack_server_checkout_test.rb
|
333
|
-
- test/unit/rails_full_stack_test.rb
|
334
|
-
- test/unit/rails_gems_full_stack_test.rb
|
335
|
-
- test/unit/reports_base_test.rb
|
336
|
-
- test/unit/reports_console_test.rb
|
337
|
-
- test/unit/reports_html_test.rb
|
338
|
-
- test/unit/reports_web_test.rb
|
339
|
-
- test/unit/resque_worker_test.rb
|
340
|
-
- test/unit/test_resque_job.rb
|
341
|
-
- test/unit/utils/file_groups_test.rb
|
342
|
-
- test/unit/utils/file_list_test.rb
|
343
|
-
- test/unit/utils/gem_list_test.rb
|
344
|
-
- test/unit/utils/lines_classifier_test.rb
|
345
|
-
- test/unit/utils/result_test.rb
|
346
|
-
- test/unit/utils/s3_report_test.rb
|
347
|
-
- test/unit/utils/source_file_line_test.rb
|
348
|
-
- test/unit/utils/source_file_test.rb
|
349
365
|
- views/file_list.erb
|
350
366
|
- views/gem_list.erb
|
351
367
|
- views/layout.erb
|
368
|
+
- views/settings.erb
|
352
369
|
- views/source_file.erb
|
353
370
|
homepage: https://github.com/danmayer/coverband
|
354
371
|
licenses:
|
@@ -369,15 +386,42 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
369
386
|
- !ruby/object:Gem::Version
|
370
387
|
version: 1.3.1
|
371
388
|
requirements: []
|
372
|
-
|
389
|
+
rubyforge_project:
|
390
|
+
rubygems_version: 2.7.8
|
373
391
|
signing_key:
|
374
392
|
specification_version: 4
|
375
393
|
summary: Rack middleware to help measure production code usage (LOC runtime usage)
|
376
394
|
test_files:
|
377
395
|
- test/benchmarks/.gitignore
|
378
396
|
- test/benchmarks/benchmark.rake
|
397
|
+
- test/benchmarks/coverage_fork.sh
|
379
398
|
- test/benchmarks/dog.rb
|
380
399
|
- test/benchmarks/graph_bench.sh
|
400
|
+
- test/coverband/adapters/base_test.rb
|
401
|
+
- test/coverband/adapters/file_store_test.rb
|
402
|
+
- test/coverband/adapters/redis_store_test.rb
|
403
|
+
- test/coverband/at_exit_test.rb
|
404
|
+
- test/coverband/collectors/coverage_test.rb
|
405
|
+
- test/coverband/configuration_test.rb
|
406
|
+
- test/coverband/coverband_test.rb
|
407
|
+
- test/coverband/integrations/background_test.rb
|
408
|
+
- test/coverband/integrations/middleware_test.rb
|
409
|
+
- test/coverband/integrations/rack_server_check_test.rb
|
410
|
+
- test/coverband/integrations/resque_worker_test.rb
|
411
|
+
- test/coverband/integrations/test_resque_job.rb
|
412
|
+
- test/coverband/reporters/base_test.rb
|
413
|
+
- test/coverband/reporters/console_test.rb
|
414
|
+
- test/coverband/reporters/html_test.rb
|
415
|
+
- test/coverband/reporters/web_test.rb
|
416
|
+
- test/coverband/utils/file_groups_test.rb
|
417
|
+
- test/coverband/utils/file_list_test.rb
|
418
|
+
- test/coverband/utils/gem_list_test.rb
|
419
|
+
- test/coverband/utils/lines_classifier_test.rb
|
420
|
+
- test/coverband/utils/result_test.rb
|
421
|
+
- test/coverband/utils/s3_report_test.rb
|
422
|
+
- test/coverband/utils/source_file_line_test.rb
|
423
|
+
- test/coverband/utils/source_file_test.rb
|
424
|
+
- test/dog.rb
|
381
425
|
- test/fake_app/basic_rack.rb
|
382
426
|
- test/fixtures/app/controllers/sample_controller.rb
|
383
427
|
- test/fixtures/app/models/user.rb
|
@@ -386,6 +430,9 @@ test_files:
|
|
386
430
|
- test/fixtures/skipped.rb
|
387
431
|
- test/fixtures/skipped_and_executed.rb
|
388
432
|
- test/fixtures/utf-8.rb
|
433
|
+
- test/integration/full_stack_test.rb
|
434
|
+
- test/integration/rails_full_stack_test.rb
|
435
|
+
- test/integration/rails_gems_full_stack_test.rb
|
389
436
|
- test/rails4_dummy/app/controllers/dummy_controller.rb
|
390
437
|
- test/rails4_dummy/config.ru
|
391
438
|
- test/rails4_dummy/config/application.rb
|
@@ -402,31 +449,3 @@ test_files:
|
|
402
449
|
- test/rails5_dummy/config/routes.rb
|
403
450
|
- test/rails_test_helper.rb
|
404
451
|
- test/test_helper.rb
|
405
|
-
- test/unit/adapters_base_test.rb
|
406
|
-
- test/unit/adapters_file_store_test.rb
|
407
|
-
- test/unit/adapters_redis_store_test.rb
|
408
|
-
- test/unit/at_exit_test.rb
|
409
|
-
- test/unit/background_test.rb
|
410
|
-
- test/unit/collectors_coverage_test.rb
|
411
|
-
- test/unit/configuration_test.rb
|
412
|
-
- test/unit/coverband_test.rb
|
413
|
-
- test/unit/dog.rb
|
414
|
-
- test/unit/full_stack_test.rb
|
415
|
-
- test/unit/middleware_test.rb
|
416
|
-
- test/unit/rack_server_checkout_test.rb
|
417
|
-
- test/unit/rails_full_stack_test.rb
|
418
|
-
- test/unit/rails_gems_full_stack_test.rb
|
419
|
-
- test/unit/reports_base_test.rb
|
420
|
-
- test/unit/reports_console_test.rb
|
421
|
-
- test/unit/reports_html_test.rb
|
422
|
-
- test/unit/reports_web_test.rb
|
423
|
-
- test/unit/resque_worker_test.rb
|
424
|
-
- test/unit/test_resque_job.rb
|
425
|
-
- test/unit/utils/file_groups_test.rb
|
426
|
-
- test/unit/utils/file_list_test.rb
|
427
|
-
- test/unit/utils/gem_list_test.rb
|
428
|
-
- test/unit/utils/lines_classifier_test.rb
|
429
|
-
- test/unit/utils/result_test.rb
|
430
|
-
- test/unit/utils/s3_report_test.rb
|
431
|
-
- test/unit/utils/source_file_line_test.rb
|
432
|
-
- test/unit/utils/source_file_test.rb
|
@@ -1,117 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require File.expand_path('../test_helper', File.dirname(__FILE__))
|
4
|
-
|
5
|
-
class ReportsBaseTest < Minitest::Test
|
6
|
-
test 'filename_from_key fix filename from a key with a swappable path' do
|
7
|
-
Coverband.configure do |config|
|
8
|
-
config.reporter = 'std_out'
|
9
|
-
config.root = '/full/remote_app/path'
|
10
|
-
end
|
11
|
-
|
12
|
-
key = '/app/is/a/path.rb'
|
13
|
-
# the code takes config.root expands and adds a '/' for the final path in roots
|
14
|
-
roots = ['/app/', '/full/remote_app/path/']
|
15
|
-
|
16
|
-
expected_path = '/full/remote_app/path/is/a/path.rb'
|
17
|
-
File.expects(:exist?).with(key).returns(false)
|
18
|
-
File.expects(:exist?).with(expected_path).returns(true)
|
19
|
-
assert_equal expected_path, Coverband::Reporters::Base.send(:filename_from_key, key, roots)
|
20
|
-
end
|
21
|
-
|
22
|
-
test 'filename_from_key fix filename a changing deploy path with double quotes' do
|
23
|
-
Coverband.configure do |config|
|
24
|
-
config.reporter = 'std_out'
|
25
|
-
config.root = '/full/remote_app/path'
|
26
|
-
end
|
27
|
-
|
28
|
-
key = '/box/apps/app_name/releases/20140725203539/app/models/user.rb'
|
29
|
-
# the code takes config.root expands and adds a '/' for the final path in roots
|
30
|
-
# note to get regex to work for changing deploy directories
|
31
|
-
# it must be double escaped in double quotes or use single qoutes
|
32
|
-
roots = ['/box/apps/app_name/releases/\\d+/', '/full/remote_app/path/']
|
33
|
-
|
34
|
-
expected_path = '/full/remote_app/path/app/models/user.rb'
|
35
|
-
File.expects(:exist?).with('/box/apps/app_name/releases/\\d+/app/models/user.rb').returns(false)
|
36
|
-
File.expects(:exist?).with(expected_path).returns(true)
|
37
|
-
assert_equal expected_path, Coverband::Reporters::Base.send(:filename_from_key, key, roots)
|
38
|
-
end
|
39
|
-
|
40
|
-
test 'filename_from_key fix filename a changing deploy path with single quotes' do
|
41
|
-
Coverband.configure do |config|
|
42
|
-
config.reporter = 'std_out'
|
43
|
-
config.root = '/full/remote_app/path'
|
44
|
-
end
|
45
|
-
|
46
|
-
key = '/box/apps/app_name/releases/20140725203539/app/models/user.rb'
|
47
|
-
# the code takes config.root expands and adds a '/' for the final path in roots
|
48
|
-
# note to get regex to work for changing deploy directories
|
49
|
-
# it must be double escaped in double quotes or use single qoutes
|
50
|
-
roots = ['/box/apps/app_name/releases/\d+/', '/full/remote_app/path/']
|
51
|
-
|
52
|
-
expected_path = '/full/remote_app/path/app/models/user.rb'
|
53
|
-
File.expects(:exist?).with('/box/apps/app_name/releases/\\d+/app/models/user.rb').returns(false)
|
54
|
-
File.expects(:exist?).with(expected_path).returns(true)
|
55
|
-
assert_equal expected_path, Coverband::Reporters::Base.send(:filename_from_key, key, roots)
|
56
|
-
end
|
57
|
-
|
58
|
-
test 'filename_from_key leave filename from a key with a local path' do
|
59
|
-
Coverband.configure do |config|
|
60
|
-
config.reporter = 'std_out'
|
61
|
-
config.root = '/full/remote_app/path'
|
62
|
-
end
|
63
|
-
|
64
|
-
key = '/full/remote_app/path/is/a/path.rb'
|
65
|
-
# the code takes config.root expands and adds a '/' for the final path in roots
|
66
|
-
roots = ['/app/', '/full/remote_app/path/']
|
67
|
-
|
68
|
-
expected_path = '/full/remote_app/path/is/a/path.rb'
|
69
|
-
assert_equal expected_path, Coverband::Reporters::Base.send(:filename_from_key, key, roots)
|
70
|
-
end
|
71
|
-
|
72
|
-
test '#merge_arrays basic merge preserves order and counts' do
|
73
|
-
first = [0, 0, 1, 0, 1]
|
74
|
-
second = [nil, 0, 1, 0, 0]
|
75
|
-
expects = [0, 0, 2, 0, 1]
|
76
|
-
|
77
|
-
assert_equal expects, Coverband::Reporters::Base.send(:merge_arrays, first, second)
|
78
|
-
end
|
79
|
-
|
80
|
-
test '#merge_arrays basic merge preserves order and counts different lengths' do
|
81
|
-
first = [0, 0, 1, 0, 1]
|
82
|
-
second = [nil, 0, 1, 0, 0, 0, 0, 1]
|
83
|
-
expects = [0, 0, 2, 0, 1, 0, 0, 1]
|
84
|
-
|
85
|
-
assert_equal expects, Coverband::Reporters::Base.send(:merge_arrays, first, second)
|
86
|
-
end
|
87
|
-
|
88
|
-
test '#merge_arrays basic merge preserves nils' do
|
89
|
-
first = [0, 1, 2, nil, nil, nil]
|
90
|
-
second = [0, 1, 2, nil, 0, 1, 2]
|
91
|
-
expects = [0, 2, 4, nil, 0, 1, 2]
|
92
|
-
|
93
|
-
assert_equal expects, Coverband::Reporters::Base.send(:merge_arrays, first, second)
|
94
|
-
end
|
95
|
-
|
96
|
-
test "#get_current_scov_data_imp doesn't ignore folders with default ignore keys" do
|
97
|
-
@redis = Redis.new
|
98
|
-
store = Coverband::Adapters::RedisStore.new(@redis)
|
99
|
-
store.clear!
|
100
|
-
|
101
|
-
Coverband.configure do |config|
|
102
|
-
config.reporter = 'std_out'
|
103
|
-
config.ignore = %w(vendor .erb$ .slim$)
|
104
|
-
config.root = '/full/remote_app/path'
|
105
|
-
config.store = store
|
106
|
-
end
|
107
|
-
|
108
|
-
key = '/a_path/that_has_erb_in/thepath.rb'
|
109
|
-
roots = ['/app/', '/full/remote_app/path/']
|
110
|
-
|
111
|
-
lines_hit = [1, 3, 6]
|
112
|
-
store.stubs(:coverage).returns(key => lines_hit)
|
113
|
-
expected = { key => [1, 3, 6] }
|
114
|
-
|
115
|
-
assert_equal expected, Coverband::Reporters::Base.send(:get_current_scov_data_imp, store, roots)
|
116
|
-
end
|
117
|
-
end
|