coverband 4.2.7 → 5.0.0.rc.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (117) hide show
  1. checksums.yaml +4 -4
  2. data/.standard.yml +25 -0
  3. data/.travis.yml +2 -1
  4. data/Gemfile +5 -7
  5. data/Gemfile.rails4 +0 -3
  6. data/Gemfile.rails6 +0 -3
  7. data/README.md +8 -77
  8. data/Rakefile +17 -17
  9. data/changes.md +18 -27
  10. data/config.ru +1 -1
  11. data/coverband.gemspec +29 -34
  12. data/lib/coverband.rb +55 -43
  13. data/lib/coverband/adapters/base.rb +17 -17
  14. data/lib/coverband/adapters/file_store.rb +2 -2
  15. data/lib/coverband/adapters/hash_redis_store.rb +24 -21
  16. data/lib/coverband/adapters/redis_store.rb +12 -12
  17. data/lib/coverband/at_exit.rb +1 -1
  18. data/lib/coverband/collectors/coverage.rb +15 -27
  19. data/lib/coverband/collectors/delta.rb +19 -9
  20. data/lib/coverband/collectors/view_tracker.rb +10 -10
  21. data/lib/coverband/configuration.rb +47 -83
  22. data/lib/coverband/integrations/background.rb +3 -3
  23. data/lib/coverband/integrations/rack_server_check.rb +3 -3
  24. data/lib/coverband/reporters/base.rb +10 -10
  25. data/lib/coverband/reporters/console_report.rb +1 -1
  26. data/lib/coverband/reporters/html_report.rb +10 -30
  27. data/lib/coverband/reporters/web.rb +56 -49
  28. data/lib/coverband/utils/absolute_file_converter.rb +6 -6
  29. data/lib/coverband/utils/html_formatter.rb +32 -61
  30. data/lib/coverband/utils/railtie.rb +16 -4
  31. data/lib/coverband/utils/relative_file_converter.rb +2 -2
  32. data/lib/coverband/utils/result.rb +6 -11
  33. data/lib/coverband/utils/results.rb +0 -10
  34. data/lib/coverband/utils/source_file.rb +21 -30
  35. data/lib/coverband/utils/tasks.rb +7 -11
  36. data/lib/coverband/version.rb +1 -1
  37. data/public/application.js +0 -30
  38. data/test/benchmarks/benchmark.rake +97 -92
  39. data/test/benchmarks/dog.rb +1 -1
  40. data/test/benchmarks/init_rails.rake +4 -4
  41. data/test/coverband/adapters/base_test.rb +29 -30
  42. data/test/coverband/adapters/file_store_test.rb +15 -16
  43. data/test/coverband/adapters/hash_redis_store_test.rb +57 -57
  44. data/test/coverband/adapters/redis_store_test.rb +26 -26
  45. data/test/coverband/at_exit_test.rb +2 -2
  46. data/test/coverband/collectors/coverage_test.rb +33 -47
  47. data/test/coverband/collectors/delta_test.rb +51 -23
  48. data/test/coverband/collectors/view_tracker_test.rb +35 -35
  49. data/test/coverband/configuration_test.rb +15 -41
  50. data/test/coverband/coverband_test.rb +11 -11
  51. data/test/coverband/integrations/background_middleware_test.rb +10 -10
  52. data/test/coverband/integrations/background_test.rb +3 -2
  53. data/test/coverband/integrations/rack_server_check_test.rb +7 -7
  54. data/test/coverband/integrations/report_middleware_test.rb +9 -9
  55. data/test/coverband/integrations/resque_worker_test.rb +9 -9
  56. data/test/coverband/integrations/test_resque_job.rb +1 -1
  57. data/test/coverband/reporters/base_test.rb +9 -9
  58. data/test/coverband/reporters/console_test.rb +6 -6
  59. data/test/coverband/reporters/html_test.rb +36 -48
  60. data/test/coverband/reporters/web_test.rb +16 -18
  61. data/test/coverband/utils/absolute_file_converter_test.rb +22 -22
  62. data/test/coverband/utils/file_hasher_test.rb +6 -12
  63. data/test/coverband/utils/file_list_test.rb +13 -13
  64. data/test/coverband/utils/html_formatter_test.rb +9 -23
  65. data/test/coverband/utils/lines_classifier_test.rb +29 -29
  66. data/test/coverband/utils/relative_file_converter_test.rb +13 -13
  67. data/test/coverband/utils/result_test.rb +18 -18
  68. data/test/coverband/utils/results_test.rb +17 -17
  69. data/test/coverband/utils/source_file_line_test.rb +46 -46
  70. data/test/coverband/utils/source_file_test.rb +38 -88
  71. data/test/dog.rb +1 -1
  72. data/test/fake_app/basic_rack.rb +2 -2
  73. data/test/fixtures/app/controllers/sample_controller.rb +1 -1
  74. data/test/fixtures/app/models/user.rb +1 -1
  75. data/test/fixtures/sample.rb +1 -1
  76. data/test/fixtures/utf-8.rb +0 -2
  77. data/test/forked/rails_full_stack_test.rb +24 -27
  78. data/test/forked/rails_rake_full_stack_test.rb +7 -26
  79. data/test/integration/full_stack_test.rb +11 -22
  80. data/test/jruby_check.rb +2 -3
  81. data/test/rails4_dummy/Rakefile +1 -1
  82. data/test/rails4_dummy/config.ru +1 -1
  83. data/test/rails4_dummy/config/application.rb +4 -4
  84. data/test/rails4_dummy/config/boot.rb +2 -2
  85. data/test/rails4_dummy/config/coverband.rb +1 -1
  86. data/test/rails4_dummy/config/coverband_missing_redis.rb +1 -1
  87. data/test/rails4_dummy/config/environment.rb +1 -1
  88. data/test/rails4_dummy/config/routes.rb +2 -2
  89. data/test/rails5_dummy/Rakefile +1 -1
  90. data/test/rails5_dummy/config.ru +1 -1
  91. data/test/rails5_dummy/config/application.rb +3 -3
  92. data/test/rails5_dummy/config/coverband.rb +8 -8
  93. data/test/rails5_dummy/config/coverband_missing_redis.rb +8 -8
  94. data/test/rails5_dummy/config/environment.rb +1 -1
  95. data/test/rails5_dummy/config/routes.rb +2 -2
  96. data/test/rails6_dummy/Rakefile +1 -1
  97. data/test/rails6_dummy/config.ru +1 -1
  98. data/test/rails6_dummy/config/application.rb +4 -4
  99. data/test/rails6_dummy/config/boot.rb +2 -2
  100. data/test/rails6_dummy/config/coverband.rb +1 -1
  101. data/test/rails6_dummy/config/coverband_missing_redis.rb +1 -1
  102. data/test/rails6_dummy/config/environment.rb +1 -1
  103. data/test/rails6_dummy/config/routes.rb +2 -2
  104. data/test/rails_test_helper.rb +11 -11
  105. data/test/test_helper.rb +41 -34
  106. data/test/unique_files.rb +10 -10
  107. data/views/layout.erb +2 -12
  108. metadata +6 -45
  109. data/.rubocop.yml +0 -86
  110. data/lib/coverband/integrations/bundler.rb +0 -8
  111. data/lib/coverband/utils/file_groups.rb +0 -53
  112. data/lib/coverband/utils/gem_list.rb +0 -31
  113. data/lib/coverband/utils/s3_report.rb +0 -105
  114. data/test/coverband/utils/file_groups_test.rb +0 -61
  115. data/test/coverband/utils/gem_list_test.rb +0 -48
  116. data/test/coverband/utils/s3_report_test.rb +0 -44
  117. data/views/gem_list.erb +0 -63
@@ -1,13 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require File.expand_path('../../test_helper', File.dirname(__FILE__))
4
- require 'aws-sdk-s3'
5
- require File.expand_path('../../../lib/coverband/reporters/web', File.dirname(__FILE__))
6
- require 'rack/test'
3
+ require File.expand_path("../../test_helper", File.dirname(__FILE__))
4
+ require File.expand_path("../../../lib/coverband/reporters/web", File.dirname(__FILE__))
5
+ require "rack/test"
7
6
 
8
- ENV['RACK_ENV'] = 'test'
7
+ ENV["RACK_ENV"] = "test"
9
8
 
10
- if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('2.2.0')
9
+ if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("2.2.0")
11
10
  module Coverband
12
11
  class WebTest < Minitest::Test
13
12
  include Rack::Test::Methods
@@ -18,29 +17,28 @@ if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('2.2.0')
18
17
 
19
18
  def teardown
20
19
  super
21
- Coverband.configuration.s3_bucket = nil
22
20
  end
23
21
 
24
- test 'renders index content' do
25
- get '/'
22
+ test "renders index content" do
23
+ get "/"
26
24
  assert last_response.ok?
27
- assert_match 'Coverband Admin', last_response.body
25
+ assert_match "Coverband Admin", last_response.body
28
26
  end
29
27
 
30
- test 'renders index content for empty path' do
31
- get ''
28
+ test "renders index content for empty path" do
29
+ get ""
32
30
  assert last_response.ok?
33
- assert_match 'Coverband Admin', last_response.body
31
+ assert_match "Coverband Admin", last_response.body
34
32
  end
35
33
 
36
- test 'renders 404' do
37
- get '/show'
34
+ test "renders 404" do
35
+ get "/show"
38
36
  assert last_response.not_found?
39
- assert_equal '404 error!', last_response.body
37
+ assert_equal "404 error!", last_response.body
40
38
  end
41
39
 
42
- test 'clears coverband' do
43
- post '/clear'
40
+ test "clears coverband" do
41
+ post "/clear"
44
42
  assert_equal 301, last_response.status
45
43
  end
46
44
  end
@@ -1,53 +1,53 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require File.expand_path('../../test_helper', File.dirname(__FILE__))
3
+ require File.expand_path("../../test_helper", File.dirname(__FILE__))
4
4
 
5
5
  module Coverband
6
6
  module Utils
7
7
  class AbsoluteFileConverterTest < ::Minitest::Test
8
8
  def test_convert
9
9
  converter = AbsoluteFileConverter.new([FileUtils.pwd])
10
- assert_equal("#{FileUtils.pwd}/lib/coverband.rb", converter.convert('./lib/coverband.rb'))
10
+ assert_equal("#{FileUtils.pwd}/lib/coverband.rb", converter.convert("./lib/coverband.rb"))
11
11
  end
12
12
 
13
13
  def test_convert_multiple_roots
14
- converter = AbsoluteFileConverter.new(['/foo/bar', FileUtils.pwd])
15
- assert_equal("#{FileUtils.pwd}/Rakefile", converter.convert('./Rakefile'))
14
+ converter = AbsoluteFileConverter.new(["/foo/bar", FileUtils.pwd])
15
+ assert_equal("#{FileUtils.pwd}/Rakefile", converter.convert("./Rakefile"))
16
16
  end
17
17
 
18
- test 'relative_path_to_full leave filename from a key with a local path' do
19
- converter = AbsoluteFileConverter.new(['/app/', '/full/remote_app/path/'])
20
- assert_equal '/full/remote_app/path/is/a/path.rb', converter.convert('/full/remote_app/path/is/a/path.rb')
18
+ test "relative_path_to_full leave filename from a key with a local path" do
19
+ converter = AbsoluteFileConverter.new(["/app/", "/full/remote_app/path/"])
20
+ assert_equal "/full/remote_app/path/is/a/path.rb", converter.convert("/full/remote_app/path/is/a/path.rb")
21
21
  end
22
22
 
23
- test 'relative_path_to_full fix filename from a key with a swappable path' do
24
- key = '/app/is/a/path.rb'
25
- converter = AbsoluteFileConverter.new(['/app/', '/full/remote_app/path/'])
26
- expected_path = '/full/remote_app/path/is/a/path.rb'
23
+ test "relative_path_to_full fix filename from a key with a swappable path" do
24
+ key = "/app/is/a/path.rb"
25
+ converter = AbsoluteFileConverter.new(["/app/", "/full/remote_app/path/"])
26
+ expected_path = "/full/remote_app/path/is/a/path.rb"
27
27
  File.expects(:exist?).with(key).returns(false)
28
28
  File.expects(:exist?).with(expected_path).returns(true)
29
29
  assert_equal expected_path, converter.convert(key)
30
30
  end
31
31
 
32
- test 'relative_path_to_full fix filename a changing deploy path with quotes' do
33
- converter = AbsoluteFileConverter.new(['/box/apps/app_name/releases/\\d+/', '/full/remote_app/path/'])
34
- expected_path = '/full/remote_app/path/app/models/user.rb'
35
- key = '/box/apps/app_name/releases/20140725203539/app/models/user.rb'
32
+ test "relative_path_to_full fix filename a changing deploy path with quotes" do
33
+ converter = AbsoluteFileConverter.new(['/box/apps/app_name/releases/\\d+/', "/full/remote_app/path/"])
34
+ expected_path = "/full/remote_app/path/app/models/user.rb"
35
+ key = "/box/apps/app_name/releases/20140725203539/app/models/user.rb"
36
36
  File.expects(:exist?).with('/box/apps/app_name/releases/\\d+/app/models/user.rb').returns(false)
37
37
  File.expects(:exist?).with(expected_path).returns(true)
38
38
  assert_equal expected_path, converter.convert(key)
39
39
  assert_equal expected_path, converter.convert(key)
40
40
  end
41
41
 
42
- test 'relative_path_to_full fix filename a changing deploy path real world examples' do
43
- current_app_root = '/var/local/company/company.d/79'
44
- converter = AbsoluteFileConverter.new(['/var/local/company/company.d/[0-9]*/', "#{current_app_root}/"])
42
+ test "relative_path_to_full fix filename a changing deploy path real world examples" do
43
+ current_app_root = "/var/local/company/company.d/79"
44
+ converter = AbsoluteFileConverter.new(["/var/local/company/company.d/[0-9]*/", "#{current_app_root}/"])
45
45
 
46
- expected_path = '/var/local/company/company.d/79/app/controllers/dashboard_controller.rb'
47
- key = '/var/local/company/company.d/78/app/controllers/dashboard_controller.rb'
48
- File.expects(:exist?).with('/var/local/company/company.d/[0-9]*/app/controllers/dashboard_controller.rb').returns(false)
46
+ expected_path = "/var/local/company/company.d/79/app/controllers/dashboard_controller.rb"
47
+ key = "/var/local/company/company.d/78/app/controllers/dashboard_controller.rb"
48
+ File.expects(:exist?).with("/var/local/company/company.d/[0-9]*/app/controllers/dashboard_controller.rb").returns(false)
49
49
  File.expects(:exist?).with(expected_path).returns(true)
50
- roots = ['/var/local/company/company.d/[0-9]*/', "#{current_app_root}/"]
50
+ # roots = ["/var/local/company/company.d/[0-9]*/", "#{current_app_root}/"]
51
51
  assert_equal expected_path, converter.convert(key)
52
52
  assert_equal expected_path, converter.convert(key)
53
53
  end
@@ -1,28 +1,22 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require File.expand_path('../../test_helper', File.dirname(__FILE__))
3
+ require File.expand_path("../../test_helper", File.dirname(__FILE__))
4
4
 
5
5
  module Coverband
6
6
  module Utils
7
7
  class FileHasherTest < Minitest::Test
8
8
  def test_hash_same_file
9
- refute_nil FileHasher.hash('./test/dog.rb')
10
- assert_equal(FileHasher.hash('./test/dog.rb'), FileHasher.hash('./test/dog.rb'))
11
- assert_equal(FileHasher.hash(File.expand_path('./test/dog.rb')), FileHasher.hash('./test/dog.rb'))
9
+ refute_nil FileHasher.hash("./test/dog.rb")
10
+ assert_equal(FileHasher.hash("./test/dog.rb"), FileHasher.hash("./test/dog.rb"))
11
+ assert_equal(FileHasher.hash(File.expand_path("./test/dog.rb")), FileHasher.hash("./test/dog.rb"))
12
12
  end
13
13
 
14
14
  def test_hash_different_files
15
- refute_equal(FileHasher.hash('./test/dog.rb'), FileHasher.hash('./lib/coverband.rb'))
15
+ refute_equal(FileHasher.hash("./test/dog.rb"), FileHasher.hash("./lib/coverband.rb"))
16
16
  end
17
17
 
18
18
  def test_hash_file_not_exists
19
- assert_nil(FileHasher.hash('./made_up_file.py'))
20
- end
21
-
22
- def test_hash_gem_file
23
- spec = Gem::Specification.find_by_name('rainbow')
24
- assert FileHasher.hash("./gems/rainbow-#{spec.version}/lib/rainbow.rb",
25
- path_converter: AbsoluteFileConverter.new(Coverband.configuration.gem_paths))
19
+ assert_nil(FileHasher.hash("./made_up_file.py"))
26
20
  end
27
21
  end
28
22
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require File.expand_path('../../test_helper', File.dirname(__FILE__))
3
+ require File.expand_path("../../test_helper", File.dirname(__FILE__))
4
4
 
5
5
  ####
6
6
  # Thanks for all the help SimpleCov https://github.com/colszowka/simplecov-html
@@ -9,46 +9,46 @@ require File.expand_path('../../test_helper', File.dirname(__FILE__))
9
9
  describe Coverband::Utils::FileList do
10
10
  subject do
11
11
  original_result = {
12
- source_fixture('sample.rb') => {'first_updated_at' => Time.at(0), 'data' => [nil, 1, 1, 1, nil, nil, 1, 1, nil, nil]},
13
- source_fixture('app/models/user.rb') => [nil, 1, 1, 1, nil, nil, 1, 0, nil, nil],
14
- source_fixture('app/controllers/sample_controller.rb') => [nil, 2, 2, 0, nil, nil, 0, nil, nil, nil]
12
+ source_fixture("sample.rb") => {"first_updated_at" => Time.at(0), "data" => [nil, 1, 1, 1, nil, nil, 1, 1, nil, nil]},
13
+ source_fixture("app/models/user.rb") => [nil, 1, 1, 1, nil, nil, 1, 0, nil, nil],
14
+ source_fixture("app/controllers/sample_controller.rb") => [nil, 2, 2, 0, nil, nil, 0, nil, nil, nil]
15
15
  }
16
16
  Coverband::Utils::Result.new(original_result).files
17
17
  end
18
18
 
19
- it 'has 11 covered lines' do
19
+ it "has 11 covered lines" do
20
20
  assert_equal 11, subject.covered_lines
21
21
  end
22
22
 
23
- it 'has 3 missed lines' do
23
+ it "has 3 missed lines" do
24
24
  assert_equal 3, subject.missed_lines
25
25
  end
26
26
 
27
- it 'has 17 never lines' do
27
+ it "has 17 never lines" do
28
28
  assert_equal 17, subject.never_lines
29
29
  end
30
30
 
31
- it 'has 14 lines of code' do
31
+ it "has 14 lines of code" do
32
32
  assert_equal 14, subject.lines_of_code
33
33
  end
34
34
 
35
- it 'has 5 skipped lines' do
35
+ it "has 5 skipped lines" do
36
36
  assert_equal 5, subject.skipped_lines
37
37
  end
38
38
 
39
- it 'has the correct covered percent' do
39
+ it "has the correct covered percent" do
40
40
  assert_equal 78.57142857142857, subject.covered_percent
41
41
  end
42
42
 
43
- it 'has the correct covered percentages' do
43
+ it "has the correct covered percentages" do
44
44
  assert_equal [50.0, 80.0, 100.0], subject.covered_percentages
45
45
  end
46
46
 
47
- it 'has the correct covered strength' do
47
+ it "has the correct covered strength" do
48
48
  assert_equal 0.9285714285714286, subject.covered_strength
49
49
  end
50
50
 
51
- it 'has correct first_seen_at' do
51
+ it "has correct first_seen_at" do
52
52
  assert_equal Time.at(0), subject.first_seen_at
53
53
  end
54
54
  end
@@ -1,41 +1,27 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require File.expand_path('../../test_helper', File.dirname(__FILE__))
3
+ require File.expand_path("../../test_helper", File.dirname(__FILE__))
4
4
 
5
5
  class HTMLFormatterTest < Minitest::Test
6
6
  def setup
7
7
  super
8
- @store = Coverband::Adapters::RedisStore.new(Coverband::Test.redis, redis_namespace: 'coverband_test')
8
+ @store = Coverband::Adapters::RedisStore.new(Coverband::Test.redis, redis_namespace: "coverband_test")
9
9
  end
10
10
 
11
- test 'generate dynamic content hosted html report' do
11
+ test "generate dynamic content hosted html report" do
12
12
  Coverband.configure do |config|
13
- config.store = @store
14
- config.ignore = ['notsomething.rb']
13
+ config.store = @store
14
+ config.ignore = ["notsomething.rb"]
15
15
  end
16
16
  mock_file_hash
17
17
  @store.send(:save_report, basic_coverage_full_path)
18
18
 
19
19
  notice = nil
20
- base_path = '/coverage'
20
+ base_path = "/coverage"
21
21
  filtered_report_files = Coverband::Reporters::Base.report(@store, {})
22
22
  html = Coverband::Utils::HTMLFormatter.new(filtered_report_files,
23
- base_path: base_path,
24
- notice: notice).format_dynamic_html!
25
- assert_match 'loading source data', html
26
- end
27
-
28
- test 'generate static HTML report file' do
29
- Coverband.configure do |config|
30
- config.store = @store
31
- config.ignore = ['notsomething.rb']
32
- end
33
- mock_file_hash
34
- @store.send(:save_report, basic_coverage_full_path)
35
-
36
- filtered_report_files = Coverband::Reporters::Base.report(@store, {})
37
- Coverband::Utils::HTMLFormatter.new(filtered_report_files).format_static_html!
38
- html = File.read("#{Coverband.configuration.root}/coverage/index.html")
39
- assert_match 'Coverage first seen', html
23
+ base_path: base_path,
24
+ notice: notice).format_dynamic_html!
25
+ assert_match "loading source data", html
40
26
  end
41
27
  end
@@ -1,34 +1,34 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require File.expand_path('../../test_helper', File.dirname(__FILE__))
3
+ require File.expand_path("../../test_helper", File.dirname(__FILE__))
4
4
 
5
5
  ####
6
6
  # Thanks for all the help SimpleCov https://github.com/colszowka/simplecov-html
7
7
  # initial version of test pulled into Coverband from Simplecov 12/17/2018
8
8
  ####
9
9
  describe Coverband::Utils::LinesClassifier do
10
- describe '#classify' do
10
+ describe "#classify" do
11
11
  def subject
12
12
  Coverband::Utils::LinesClassifier.new
13
13
  end
14
14
 
15
- describe 'relevant lines' do
16
- it 'determines code as relevant' do
15
+ describe "relevant lines" do
16
+ it "determines code as relevant" do
17
17
  classified_lines = subject.classify [
18
- 'module Foo',
19
- ' class Baz',
20
- ' def Bar',
18
+ "module Foo",
19
+ " class Baz",
20
+ " def Bar",
21
21
  " puts 'hi'",
22
- ' end',
23
- ' end',
24
- 'end'
22
+ " end",
23
+ " end",
24
+ "end"
25
25
  ]
26
26
 
27
27
  assert_equal 7, classified_lines.length
28
28
  assert(classified_lines.all? { |line| line == Coverband::Utils::LinesClassifier::RELEVANT })
29
29
  end
30
30
 
31
- it 'determines invalid UTF-8 byte sequences as relevant' do
31
+ it "determines invalid UTF-8 byte sequences as relevant" do
32
32
  classified_lines = subject.classify [
33
33
  "bytes = \"\xF1t\xEBrn\xE2ti\xF4n\xE0liz\xE6ti\xF8n\""
34
34
  ]
@@ -38,11 +38,11 @@ describe Coverband::Utils::LinesClassifier do
38
38
  end
39
39
  end
40
40
 
41
- describe 'not-relevant lines' do
42
- it 'determines whitespace is not-relevant' do
41
+ describe "not-relevant lines" do
42
+ it "determines whitespace is not-relevant" do
43
43
  classified_lines = subject.classify [
44
- '',
45
- ' ',
44
+ "",
45
+ " ",
46
46
  "\t\t"
47
47
  ]
48
48
 
@@ -50,11 +50,11 @@ describe Coverband::Utils::LinesClassifier do
50
50
  assert(classified_lines.all? { |line| line == Coverband::Utils::LinesClassifier::NOT_RELEVANT })
51
51
  end
52
52
 
53
- describe 'comments' do
54
- it 'determines comments are not-relevant' do
53
+ describe "comments" do
54
+ it "determines comments are not-relevant" do
55
55
  classified_lines = subject.classify [
56
- '#Comment',
57
- ' # Leading space comment',
56
+ "#Comment",
57
+ " # Leading space comment",
58
58
  "\t# Leading tab comment"
59
59
  ]
60
60
 
@@ -72,27 +72,27 @@ describe Coverband::Utils::LinesClassifier do
72
72
  end
73
73
  end
74
74
 
75
- describe ':nocov: blocks' do
76
- it 'determines :nocov: blocks are not-relevant' do
75
+ describe ":nocov: blocks" do
76
+ it "determines :nocov: blocks are not-relevant" do
77
77
  classified_lines = subject.classify [
78
- '# :nocov:',
79
- 'def hi',
80
- 'end',
81
- '# :nocov:'
78
+ "# :nocov:",
79
+ "def hi",
80
+ "end",
81
+ "# :nocov:"
82
82
  ]
83
83
 
84
84
  assert_equal 4, classified_lines.length
85
85
  assert(classified_lines.all? { |line| line == Coverband::Utils::LinesClassifier::NOT_RELEVANT })
86
86
  end
87
87
 
88
- it 'determines all lines after a non-closing :nocov: as not-relevant' do
88
+ it "determines all lines after a non-closing :nocov: as not-relevant" do
89
89
  classified_lines = subject.classify [
90
- '# :nocov:',
90
+ "# :nocov:",
91
91
  "puts 'Not relevant'",
92
- '# :nocov:',
92
+ "# :nocov:",
93
93
  "puts 'Relevant again'",
94
94
  "puts 'Still relevant'",
95
- '# :nocov:',
95
+ "# :nocov:",
96
96
  "puts 'Not relevant till the end'",
97
97
  "puts 'Ditto'"
98
98
  ]
@@ -1,38 +1,38 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require File.expand_path('../../test_helper', File.dirname(__FILE__))
3
+ require File.expand_path("../../test_helper", File.dirname(__FILE__))
4
4
 
5
5
  module Coverband
6
6
  module Utils
7
7
  class RelativeFileConverterTest < ::Minitest::Test
8
8
  def test_convert
9
- converter = RelativeFileConverter.new(['/bar/tmp/'])
10
- assert_equal('./gracie.rb', converter.convert('/bar/tmp/gracie.rb'))
9
+ converter = RelativeFileConverter.new(["/bar/tmp/"])
10
+ assert_equal("./gracie.rb", converter.convert("/bar/tmp/gracie.rb"))
11
11
  end
12
12
 
13
13
  def test_convert_without_leading_forward_slash
14
- converter = RelativeFileConverter.new(['/foo/bar'])
15
- assert_equal('./file.rb', converter.convert('/foo/bar/file.rb'))
14
+ converter = RelativeFileConverter.new(["/foo/bar"])
15
+ assert_equal("./file.rb", converter.convert("/foo/bar/file.rb"))
16
16
  end
17
17
 
18
18
  def test_multiple_roots
19
- converter = RelativeFileConverter.new(['/bar/tmp/', '/foo/bar/'])
20
- assert_equal('./josie.rb', converter.convert('/foo/bar/josie.rb'))
19
+ converter = RelativeFileConverter.new(["/bar/tmp/", "/foo/bar/"])
20
+ assert_equal("./josie.rb", converter.convert("/foo/bar/josie.rb"))
21
21
  end
22
22
 
23
23
  def test_no_match
24
- converter = RelativeFileConverter.new(['/bar/tmp/', '/foo/bar/'])
25
- assert_equal('/foo/josie.rb', converter.convert('/foo/josie.rb'))
24
+ converter = RelativeFileConverter.new(["/bar/tmp/", "/foo/bar/"])
25
+ assert_equal("/foo/josie.rb", converter.convert("/foo/josie.rb"))
26
26
  end
27
27
 
28
28
  def test_middle_path_match
29
- converter = RelativeFileConverter.new(['/bar/tmp/', '/foo/bar/'])
30
- assert_equal('/tmp/foo/bar/josie.rb', converter.convert('/tmp/foo/bar/josie.rb'))
29
+ converter = RelativeFileConverter.new(["/bar/tmp/", "/foo/bar/"])
30
+ assert_equal("/tmp/foo/bar/josie.rb", converter.convert("/tmp/foo/bar/josie.rb"))
31
31
  end
32
32
 
33
33
  def test_already_relative_file
34
- converter = RelativeFileConverter.new(['/bar/tmp/', '/foo/bar/'])
35
- assert_equal('./foo/bar/josie.rb', converter.convert('./foo/bar/josie.rb'))
34
+ converter = RelativeFileConverter.new(["/bar/tmp/", "/foo/bar/"])
35
+ assert_equal("./foo/bar/josie.rb", converter.convert("./foo/bar/josie.rb"))
36
36
  end
37
37
  end
38
38
  end