coverband 4.2.5 → 5.0.0.rc.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (123) 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 +24 -77
  8. data/Rakefile +17 -17
  9. data/changes.md +31 -34
  10. data/config.ru +1 -1
  11. data/coverband.gemspec +30 -34
  12. data/lib/alternative_coverband_patch.rb +5 -0
  13. data/lib/coverband.rb +68 -44
  14. data/lib/coverband/adapters/base.rb +17 -18
  15. data/lib/coverband/adapters/file_store.rb +38 -6
  16. data/lib/coverband/adapters/hash_redis_store.rb +24 -21
  17. data/lib/coverband/adapters/redis_store.rb +12 -12
  18. data/lib/coverband/adapters/stdout_store.rb +41 -0
  19. data/lib/coverband/adapters/web_service_store.rb +157 -0
  20. data/lib/coverband/at_exit.rb +1 -1
  21. data/lib/coverband/collectors/coverage.rb +15 -27
  22. data/lib/coverband/collectors/delta.rb +29 -9
  23. data/lib/coverband/collectors/view_tracker.rb +19 -11
  24. data/lib/coverband/collectors/view_tracker_service.rb +59 -0
  25. data/lib/coverband/configuration.rb +121 -88
  26. data/lib/coverband/integrations/background.rb +6 -6
  27. data/lib/coverband/integrations/rack_server_check.rb +3 -3
  28. data/lib/coverband/integrations/resque.rb +13 -1
  29. data/lib/coverband/reporters/base.rb +10 -10
  30. data/lib/coverband/reporters/console_report.rb +1 -1
  31. data/lib/coverband/reporters/html_report.rb +10 -30
  32. data/lib/coverband/reporters/web.rb +55 -50
  33. data/lib/coverband/utils/absolute_file_converter.rb +6 -6
  34. data/lib/coverband/utils/html_formatter.rb +32 -61
  35. data/lib/coverband/utils/railtie.rb +23 -6
  36. data/lib/coverband/utils/relative_file_converter.rb +2 -2
  37. data/lib/coverband/utils/result.rb +6 -11
  38. data/lib/coverband/utils/results.rb +0 -10
  39. data/lib/coverband/utils/source_file.rb +21 -30
  40. data/lib/coverband/utils/tasks.rb +8 -11
  41. data/lib/coverband/version.rb +1 -1
  42. data/public/application.js +0 -30
  43. data/test/benchmarks/benchmark.rake +97 -92
  44. data/test/benchmarks/dog.rb +1 -1
  45. data/test/benchmarks/init_rails.rake +4 -4
  46. data/test/coverband/adapters/base_test.rb +29 -30
  47. data/test/coverband/adapters/file_store_test.rb +19 -20
  48. data/test/coverband/adapters/hash_redis_store_test.rb +57 -57
  49. data/test/coverband/adapters/redis_store_test.rb +26 -26
  50. data/test/coverband/adapters/web_service_store_test.rb +56 -0
  51. data/test/coverband/at_exit_test.rb +2 -2
  52. data/test/coverband/collectors/coverage_test.rb +33 -47
  53. data/test/coverband/collectors/delta_test.rb +52 -23
  54. data/test/coverband/collectors/view_tracker_test.rb +35 -35
  55. data/test/coverband/configuration_test.rb +27 -53
  56. data/test/coverband/coverband_test.rb +11 -11
  57. data/test/coverband/integrations/background_middleware_test.rb +10 -10
  58. data/test/coverband/integrations/background_test.rb +6 -5
  59. data/test/coverband/integrations/rack_server_check_test.rb +7 -7
  60. data/test/coverband/integrations/report_middleware_test.rb +9 -9
  61. data/test/coverband/integrations/resque_worker_test.rb +9 -9
  62. data/test/coverband/integrations/test_resque_job.rb +1 -1
  63. data/test/coverband/reporters/base_test.rb +9 -9
  64. data/test/coverband/reporters/console_test.rb +6 -6
  65. data/test/coverband/reporters/html_test.rb +36 -48
  66. data/test/coverband/reporters/web_test.rb +16 -18
  67. data/test/coverband/utils/absolute_file_converter_test.rb +22 -22
  68. data/test/coverband/utils/file_hasher_test.rb +6 -12
  69. data/test/coverband/utils/file_list_test.rb +13 -13
  70. data/test/coverband/utils/html_formatter_test.rb +9 -23
  71. data/test/coverband/utils/lines_classifier_test.rb +29 -29
  72. data/test/coverband/utils/relative_file_converter_test.rb +13 -13
  73. data/test/coverband/utils/result_test.rb +18 -18
  74. data/test/coverband/utils/results_test.rb +17 -17
  75. data/test/coverband/utils/source_file_line_test.rb +46 -46
  76. data/test/coverband/utils/source_file_test.rb +38 -88
  77. data/test/dog.rb +1 -1
  78. data/test/fake_app/basic_rack.rb +2 -2
  79. data/test/fixtures/app/controllers/sample_controller.rb +1 -1
  80. data/test/fixtures/app/models/user.rb +1 -1
  81. data/test/fixtures/sample.rb +1 -1
  82. data/test/fixtures/utf-8.rb +0 -2
  83. data/test/forked/rails_full_stack_test.rb +24 -27
  84. data/test/forked/rails_rake_full_stack_test.rb +7 -26
  85. data/test/integration/full_stack_test.rb +11 -22
  86. data/test/jruby_check.rb +2 -3
  87. data/test/rails4_dummy/Rakefile +1 -1
  88. data/test/rails4_dummy/config.ru +1 -1
  89. data/test/rails4_dummy/config/application.rb +4 -4
  90. data/test/rails4_dummy/config/boot.rb +2 -2
  91. data/test/rails4_dummy/config/coverband.rb +1 -1
  92. data/test/rails4_dummy/config/coverband_missing_redis.rb +1 -1
  93. data/test/rails4_dummy/config/environment.rb +1 -1
  94. data/test/rails4_dummy/config/routes.rb +2 -2
  95. data/test/rails5_dummy/Rakefile +1 -1
  96. data/test/rails5_dummy/config.ru +1 -1
  97. data/test/rails5_dummy/config/application.rb +3 -3
  98. data/test/rails5_dummy/config/coverband.rb +8 -8
  99. data/test/rails5_dummy/config/coverband_missing_redis.rb +8 -8
  100. data/test/rails5_dummy/config/environment.rb +1 -1
  101. data/test/rails5_dummy/config/routes.rb +2 -2
  102. data/test/rails6_dummy/Rakefile +1 -1
  103. data/test/rails6_dummy/config.ru +1 -1
  104. data/test/rails6_dummy/config/application.rb +4 -4
  105. data/test/rails6_dummy/config/boot.rb +2 -2
  106. data/test/rails6_dummy/config/coverband.rb +1 -1
  107. data/test/rails6_dummy/config/coverband_missing_redis.rb +1 -1
  108. data/test/rails6_dummy/config/environment.rb +1 -1
  109. data/test/rails6_dummy/config/routes.rb +2 -2
  110. data/test/rails_test_helper.rb +11 -11
  111. data/test/test_helper.rb +43 -34
  112. data/test/unique_files.rb +10 -10
  113. data/views/layout.erb +2 -12
  114. metadata +15 -34
  115. data/.rubocop.yml +0 -84
  116. data/lib/coverband/integrations/bundler.rb +0 -8
  117. data/lib/coverband/utils/file_groups.rb +0 -53
  118. data/lib/coverband/utils/gem_list.rb +0 -31
  119. data/lib/coverband/utils/s3_report.rb +0 -105
  120. data/test/coverband/utils/file_groups_test.rb +0 -61
  121. data/test/coverband/utils/gem_list_test.rb +0 -48
  122. data/test/coverband/utils/s3_report_test.rb +0 -44
  123. data/views/gem_list.erb +0 -63
@@ -1,57 +1,46 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require File.expand_path('../test_helper', File.dirname(__FILE__))
4
- require 'rack'
3
+ require File.expand_path("../test_helper", File.dirname(__FILE__))
4
+ require "rack"
5
5
 
6
6
  class FullStackTest < Minitest::Test
7
7
  REDIS_STORAGE_FORMAT_VERSION = Coverband::Adapters::RedisStore::REDIS_STORAGE_FORMAT_VERSION
8
- TEST_RACK_APP = '../fake_app/basic_rack.rb'
8
+ TEST_RACK_APP = "../fake_app/basic_rack.rb"
9
9
 
10
10
  def setup
11
11
  super
12
12
  Coverband::Collectors::Coverage.instance.reset_instance
13
13
  Coverband.configure do |config|
14
- config.s3_bucket = nil
15
14
  config.background_reporting_enabled = false
16
15
  config.track_gems = true
17
16
  end
18
17
  Coverband.start
19
18
  Coverband::Collectors::Coverage.instance.eager_loading!
20
- @rack_file = require_unique_file 'fake_app/basic_rack.rb'
19
+ @rack_file = require_unique_file "fake_app/basic_rack.rb"
21
20
  Coverband.report_coverage
22
21
  Coverband::Collectors::Coverage.instance.runtime!
23
22
  end
24
23
 
25
- test 'call app' do
26
- request = Rack::MockRequest.env_for('/anything.json')
24
+ test "call app" do
25
+ request = Rack::MockRequest.env_for("/anything.json")
27
26
  middleware = Coverband::BackgroundMiddleware.new(fake_app_with_lines)
28
27
  results = middleware.call(request)
29
- assert_equal 'Hello Rack!', results.last
28
+ assert_equal "Hello Rack!", results.last
30
29
  Coverband.report_coverage
31
30
  expected = [nil, nil, 0, nil, 0, 0, 1, nil, nil]
32
- assert_equal expected, Coverband.configuration.store.coverage[@rack_file]['data']
31
+ assert_equal expected, Coverband.configuration.store.coverage[@rack_file]["data"]
33
32
 
34
33
  # additional calls increase count by 1
35
34
  middleware.call(request)
36
35
  Coverband.report_coverage
37
36
  expected = [nil, nil, 0, nil, 0, 0, 2, nil, nil]
38
- assert_equal expected, Coverband.configuration.store.coverage[@rack_file]['data']
37
+ assert_equal expected, Coverband.configuration.store.coverage[@rack_file]["data"]
39
38
 
40
39
  # class coverage
41
40
  Coverband.eager_loading_coverage!
42
- Coverband.configuration.store.coverage[@rack_file]['data']
41
+ Coverband.configuration.store.coverage[@rack_file]["data"]
43
42
  expected = [nil, nil, 1, nil, 1, 1, 0, nil, nil]
44
- end
45
-
46
- test 'call app with gem tracking' do
47
- require 'rainbow'
48
- Rainbow('this text is red').red
49
- request = Rack::MockRequest.env_for('/anything.json')
50
- middleware = Coverband::BackgroundMiddleware.new(fake_app_with_lines)
51
- results = middleware.call(request)
52
- assert_equal 'Hello Rack!', results.last
53
- Coverband.report_coverage
54
- assert Coverband.configuration.store.coverage.keys.any? { |key| key.end_with?('rainbow/global.rb') }
43
+ assert_equal expected, Coverband.configuration.store.coverage[@rack_file]["data"]
55
44
  end
56
45
 
57
46
  private
@@ -1,8 +1,8 @@
1
- require 'coverage'
1
+ require "coverage"
2
2
 
3
3
  Coverage.start
4
4
 
5
- require './test/dog.rb'
5
+ require "./test/dog.rb"
6
6
 
7
7
  puts Coverage.peek_result
8
8
 
@@ -11,4 +11,3 @@ puts Dog.new.bark
11
11
  puts Coverage.peek_result
12
12
 
13
13
  puts "done"
14
-
@@ -1,6 +1,6 @@
1
1
  # Add your own tasks in files placed in lib/tasks ending in .rake,
2
2
  # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
3
 
4
- require_relative 'config/application'
4
+ require_relative "config/application"
5
5
 
6
6
  Rails.application.load_tasks
@@ -1,4 +1,4 @@
1
1
  # This file is used by Rack-based servers to start the application.
2
2
 
3
- require ::File.expand_path('../config/environment', __FILE__)
3
+ require ::File.expand_path("../config/environment", __FILE__)
4
4
  run Rails.application
@@ -1,10 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require File.expand_path('boot', __dir__)
3
+ require File.expand_path("boot", __dir__)
4
4
 
5
- require 'rails'
6
- require 'action_controller/railtie'
7
- require 'coverband'
5
+ require "rails"
6
+ require "action_controller/railtie"
7
+ require "coverband"
8
8
  Bundler.require(*Rails.groups)
9
9
 
10
10
  module Rails4Dummy
@@ -1,3 +1,3 @@
1
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
1
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", __FILE__)
2
2
 
3
- require 'bundler/setup' # Set up gems listed in the Gemfile.
3
+ require "bundler/setup" # Set up gems listed in the Gemfile.
@@ -1,3 +1,3 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative '../../rails5_dummy/config/coverband'
3
+ require_relative "../../rails5_dummy/config/coverband"
@@ -1,3 +1,3 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative '../../rails5_dummy/config/coverband_missing_redis'
3
+ require_relative "../../rails5_dummy/config/coverband_missing_redis"
@@ -1,5 +1,5 @@
1
1
  # Load the Rails application.
2
- require File.expand_path('../application', __FILE__)
2
+ require File.expand_path("../application", __FILE__)
3
3
 
4
4
  # Initialize the Rails application.
5
5
  Rails.application.initialize!
@@ -1,4 +1,4 @@
1
1
  Rails.application.routes.draw do
2
- get 'dummy/show'
3
- mount Coverband::Reporters::Web.new, at: '/coverage'
2
+ get "dummy/show"
3
+ mount Coverband::Reporters::Web.new, at: "/coverage"
4
4
  end
@@ -1,6 +1,6 @@
1
1
  # Add your own tasks in files placed in lib/tasks ending in .rake,
2
2
  # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
3
 
4
- require_relative 'config/application'
4
+ require_relative "config/application"
5
5
 
6
6
  Rails.application.load_tasks
@@ -1,3 +1,3 @@
1
- require_relative 'config/environment'
1
+ require_relative "config/environment"
2
2
 
3
3
  run Rails.application
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'rails'
4
- require 'action_controller/railtie'
5
- require 'coverband'
3
+ require "rails"
4
+ require "action_controller/railtie"
5
+ require "coverband"
6
6
  Bundler.require(*Rails.groups)
7
7
 
8
8
  module Rails5Dummy
@@ -1,15 +1,15 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  Coverband.configure do |config|
4
- config.root = Dir.pwd
5
- config.store = Coverband::Adapters::RedisStore.new(Redis.new(db: 2, url: ENV['REDIS_URL']), redis_namespace: 'coverband_test') if defined? Redis
6
- config.ignore = %w[.erb$ .slim$]
7
- config.root_paths = []
8
- config.logger = Rails.logger
9
- config.verbose = true
4
+ config.root = Dir.pwd
5
+ config.store = Coverband::Adapters::RedisStore.new(Redis.new(db: 2, url: ENV["REDIS_URL"]), redis_namespace: "coverband_test") if defined? Redis
6
+ config.ignore = %w[.erb$ .slim$]
7
+ config.root_paths = []
8
+ config.logger = Rails.logger
9
+ config.verbose = true
10
10
  config.background_reporting_enabled = true
11
11
  config.track_gems = true
12
12
  config.gem_details = true
13
- config.use_oneshot_lines_coverage = true if ENV['ONESHOT']
14
- config.simulate_oneshot_lines_coverage = true if ENV['SIMULATE_ONESHOT']
13
+ config.use_oneshot_lines_coverage = true if ENV["ONESHOT"]
14
+ config.simulate_oneshot_lines_coverage = true if ENV["SIMULATE_ONESHOT"]
15
15
  end
@@ -1,15 +1,15 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  Coverband.configure do |config|
4
- config.root = Dir.pwd
5
- config.store = Coverband::Adapters::RedisStore.new(Redis.new(db: 2, url: 'redis://127.0.0.1:123'), redis_namespace: 'coverband_test') if defined? Redis
6
- config.ignore = %w[vendor .erb$ .slim$]
7
- config.root_paths = []
8
- config.logger = Rails.logger
9
- config.verbose = true
4
+ config.root = Dir.pwd
5
+ config.store = Coverband::Adapters::RedisStore.new(Redis.new(db: 2, url: "redis://127.0.0.1:123"), redis_namespace: "coverband_test") if defined? Redis
6
+ config.ignore = %w[vendor .erb$ .slim$]
7
+ config.root_paths = []
8
+ config.logger = Rails.logger
9
+ config.verbose = true
10
10
  config.background_reporting_enabled = true
11
11
  config.track_gems = true
12
12
  config.gem_details = true
13
- config.use_oneshot_lines_coverage = true if ENV['ONESHOT']
14
- config.simulate_oneshot_lines_coverage = true if ENV['SIMULATE_ONESHOT']
13
+ config.use_oneshot_lines_coverage = true if ENV["ONESHOT"]
14
+ config.simulate_oneshot_lines_coverage = true if ENV["SIMULATE_ONESHOT"]
15
15
  end
@@ -1,2 +1,2 @@
1
- require_relative 'application'
1
+ require_relative "application"
2
2
  Rails.application.initialize!
@@ -1,4 +1,4 @@
1
1
  Rails.application.routes.draw do
2
- get 'dummy/show'
3
- mount Coverband::Reporters::Web.new, at: '/coverage'
2
+ get "dummy/show"
3
+ mount Coverband::Reporters::Web.new, at: "/coverage"
4
4
  end
@@ -1,6 +1,6 @@
1
1
  # Add your own tasks in files placed in lib/tasks ending in .rake,
2
2
  # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
3
 
4
- require_relative 'config/application'
4
+ require_relative "config/application"
5
5
 
6
6
  Rails.application.load_tasks
@@ -1,4 +1,4 @@
1
1
  # This file is used by Rack-based servers to start the application.
2
2
 
3
- require ::File.expand_path('../config/environment', __FILE__)
3
+ require ::File.expand_path("../config/environment", __FILE__)
4
4
  run Rails.application
@@ -1,10 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require File.expand_path('boot', __dir__)
3
+ require File.expand_path("boot", __dir__)
4
4
 
5
- require 'rails'
6
- require 'action_controller/railtie'
7
- require 'coverband'
5
+ require "rails"
6
+ require "action_controller/railtie"
7
+ require "coverband"
8
8
  Bundler.require(*Rails.groups)
9
9
 
10
10
  module Rails6Dummy
@@ -1,3 +1,3 @@
1
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
1
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", __FILE__)
2
2
 
3
- require 'bundler/setup' # Set up gems listed in the Gemfile.
3
+ require "bundler/setup" # Set up gems listed in the Gemfile.
@@ -1,3 +1,3 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative '../../rails5_dummy/config/coverband'
3
+ require_relative "../../rails5_dummy/config/coverband"
@@ -1,3 +1,3 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative '../../rails5_dummy/config/coverband_missing_redis'
3
+ require_relative "../../rails5_dummy/config/coverband_missing_redis"
@@ -1,5 +1,5 @@
1
1
  # Load the Rails application.
2
- require File.expand_path('../application', __FILE__)
2
+ require File.expand_path("../application", __FILE__)
3
3
 
4
4
  # Initialize the Rails application.
5
5
  Rails.application.initialize!
@@ -1,4 +1,4 @@
1
1
  Rails.application.routes.draw do
2
- get 'dummy/show'
3
- mount Coverband::Reporters::Web.new, at: '/coverage'
2
+ get "dummy/show"
3
+ mount Coverband::Reporters::Web.new, at: "/coverage"
4
4
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'minitest'
4
- require 'minitest/fork_executor'
3
+ require "minitest"
4
+ require "minitest/fork_executor"
5
5
 
6
6
  # Forked executor includes autorun which does not work with qrush/m
7
7
  # https://github.com/qrush/m/issues/26
@@ -9,25 +9,25 @@ require 'minitest/fork_executor'
9
9
  if defined?(M)
10
10
  Minitest.class_eval do
11
11
  def self.autorun
12
- puts 'No autorunning'
12
+ puts "No autorunning"
13
13
  end
14
14
  end
15
15
  end
16
16
 
17
17
  Minitest.parallel_executor = Minitest::ForkExecutor.new
18
- require File.expand_path('./test_helper', File.dirname(__FILE__))
19
- require 'capybara'
20
- require 'capybara/minitest'
18
+ require File.expand_path("./test_helper", File.dirname(__FILE__))
19
+ require "capybara"
20
+ require "capybara/minitest"
21
21
  def rails_setup
22
- ENV['RAILS_ENV'] = 'test'
23
- require 'rails'
22
+ ENV["RAILS_ENV"] = "test"
23
+ require "rails"
24
24
  # coverband must be required after rails
25
25
  Coverband.configure("./test/rails#{Rails::VERSION::MAJOR}_dummy/config/coverband.rb")
26
- load 'coverband/utils/railtie.rb'
26
+ load "coverband/utils/railtie.rb"
27
27
 
28
28
  require_relative "../test/rails#{Rails::VERSION::MAJOR}_dummy/config/environment"
29
- require 'capybara/rails'
29
+ require "capybara/rails"
30
30
  # Our coverage report is wrapped in display:none as of now
31
31
  Capybara.ignore_hidden_elements = false
32
- require 'mocha/minitest'
32
+ require "mocha/minitest"
33
33
  end
@@ -1,28 +1,36 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # This lets us ignore warnings from our test dependencies when loaded
4
- # We do this because of aws-sdk-s3
5
- # aws-sdk-s3 is written in such a way to cause dozens of warnings
6
3
  original_verbosity = $VERBOSE
7
4
  $VERBOSE = nil
8
- require 'rubygems'
9
- require 'aws-sdk-s3'
10
- require 'simplecov'
11
- require 'coveralls'
12
- require 'minitest/autorun'
13
- require 'mocha/minitest'
14
- require 'ostruct'
15
- require 'json'
16
- require 'redis'
17
- require 'resque'
5
+ require "rubygems"
6
+ require "simplecov"
7
+ require "coveralls"
8
+ require "minitest/autorun"
9
+ require "mocha/minitest"
10
+ require "ostruct"
11
+ require "json"
12
+ require "redis"
13
+ require "resque"
14
+
15
+ require "coverband"
16
+ require "coverband/reporters/web"
17
+ require "coverband/utils/html_formatter"
18
+ require "coverband/utils/result"
19
+ require "coverband/utils/file_list"
20
+ require "coverband/utils/source_file"
21
+ require "coverband/utils/lines_classifier"
22
+ require "coverband/utils/results"
23
+ require "coverband/reporters/html_report"
24
+ require "webmock/minitest"
25
+
18
26
  # require 'pry-byebug' unless ENV['CI'] # Ruby 2.3 on CI crashes on pry & JRuby doesn't support it
19
- require_relative 'unique_files'
27
+ require_relative "unique_files"
20
28
  $VERBOSE = original_verbosity
21
29
 
22
- unless ENV['ONESHOT'] || ENV['SIMULATE_ONESHOT']
30
+ unless ENV["ONESHOT"] || ENV["SIMULATE_ONESHOT"]
23
31
  SimpleCov.formatter = Coveralls::SimpleCov::Formatter
24
32
  SimpleCov.start do
25
- add_filter 'test/forked'
33
+ add_filter "test/forked"
26
34
  end
27
35
 
28
36
  Coveralls.wear!
@@ -37,14 +45,15 @@ module Coverband
37
45
  end
38
46
 
39
47
  def self.reset
40
- Coverband.configuration.redis_namespace = 'coverband_test'
41
- Coverband.configuration.store.instance_variable_set(:@redis_namespace, 'coverband_test')
48
+ Coverband.configuration.redis_namespace = "coverband_test"
49
+ Coverband.configuration.store.instance_variable_set(:@redis_namespace, "coverband_test")
42
50
  Coverband.configuration.store.class.class_variable_set(:@@path_cache, {})
43
51
  Coverband.configuration.reset
44
52
  Coverband::Collectors::Coverage.instance.reset_instance
45
53
  Coverband::Utils::RelativeFileConverter.reset
46
54
  Coverband::Utils::AbsoluteFileConverter.reset
47
- Coverband.configuration.redis_namespace = 'coverband_test'
55
+ Coverband.configuration.reporting_wiggle = 0
56
+ Coverband.configuration.redis_namespace = "coverband_test"
48
57
  Coverband::Background.stop
49
58
  Coverband.configuration.store.instance_variable_set(:@redis, redis)
50
59
  redis.flushdb
@@ -61,19 +70,19 @@ Minitest::Test.class_eval do
61
70
  prepend Coverband::Test
62
71
  end
63
72
 
64
- TEST_COVERAGE_FILE = '/tmp/fake_file.json'
73
+ TEST_COVERAGE_FILE = "/tmp/fake_file.json"
65
74
 
66
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
75
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
67
76
  $LOAD_PATH.unshift(File.dirname(__FILE__))
68
77
 
69
78
  Mocha::Configuration.prevent(:stubbing_method_unnecessarily)
70
79
  Mocha::Configuration.prevent(:stubbing_non_existent_method)
71
80
 
72
81
  def test(name, &block)
73
- test_name = "test_#{name.gsub(/\s+/, '_')}".to_sym
82
+ test_name = "test_#{name.gsub(/\s+/, "_")}".to_sym
74
83
  defined = begin
75
84
  instance_method(test_name)
76
- rescue StandardError
85
+ rescue
77
86
  false
78
87
  end
79
88
  raise "#{test_name} is already defined in #{self}" if defined
@@ -87,7 +96,7 @@ def test(name, &block)
87
96
  end
88
97
  end
89
98
 
90
- def mock_file_hash(hash: 'abcd')
99
+ def mock_file_hash(hash: "abcd")
91
100
  Coverband::Utils::FileHasher.expects(:hash).at_least_once.returns(hash)
92
101
  end
93
102
 
@@ -96,15 +105,15 @@ def example_line
96
105
  end
97
106
 
98
107
  def basic_coverage
99
- { 'app_path/dog.rb' => example_line }
108
+ {"app_path/dog.rb" => example_line}
100
109
  end
101
110
 
102
111
  def basic_coverage_full_path
103
- { basic_coverage_file_full_path => example_line }
112
+ {basic_coverage_file_full_path => example_line}
104
113
  end
105
114
 
106
115
  def basic_source_fixture_coverage
107
- { source_fixture('sample.rb') => example_line }
116
+ {source_fixture("sample.rb") => example_line}
108
117
  end
109
118
 
110
119
  def basic_coverage_file_full_path
@@ -112,11 +121,11 @@ def basic_coverage_file_full_path
112
121
  end
113
122
 
114
123
  def source_fixture(filename)
115
- File.expand_path(File.join(File.dirname(__FILE__), 'fixtures', filename))
124
+ File.expand_path(File.join(File.dirname(__FILE__), "fixtures", filename))
116
125
  end
117
126
 
118
127
  def fixtures_root
119
- File.expand_path(File.join(File.dirname(__FILE__), 'fixtures'))
128
+ File.expand_path(File.join(File.dirname(__FILE__), "fixtures"))
120
129
  end
121
130
 
122
131
  def test_root
@@ -127,13 +136,13 @@ end
127
136
  # This handles an issue where the store is setup in tests prior to being able to set the namespace
128
137
  ###
129
138
  def store
130
- if Coverband.configuration.store.redis_namespace == 'coverband_test'
131
- Coverband.configuration.store
139
+ if Coverband.configuration.store.redis_namespace == "coverband_test"
140
+ # noop
132
141
  else
133
- Coverband.configuration.redis_namespace = 'coverband_test'
142
+ Coverband.configuration.redis_namespace = "coverband_test"
134
143
  Coverband.configuration.instance_variable_set(:@store, nil)
135
- Coverband.configuration.store
136
144
  end
145
+ Coverband.configuration.store
137
146
  end
138
147
 
139
148
  # Taken from http://stackoverflow.com/questions/4459330/how-do-i-temporarily-redirect-stderr-in-ruby
@@ -150,7 +159,7 @@ ensure
150
159
  $stderr = previous_stderr
151
160
  end
152
161
 
153
- require 'coverband'
162
+ require "coverband"
154
163
 
155
164
  Coverband::Configuration.class_eval do
156
165
  def test_env