coverband 4.2.7 → 5.0.0.rc.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.standard.yml +26 -0
- data/.travis.yml +2 -1
- data/Gemfile +5 -7
- data/Gemfile.rails4 +0 -3
- data/Gemfile.rails6 +0 -3
- data/README.md +8 -77
- data/Rakefile +17 -17
- data/changes.md +30 -28
- data/config.ru +1 -1
- data/coverband.gemspec +31 -34
- data/lib/coverband.rb +68 -44
- data/lib/coverband/adapters/base.rb +17 -18
- data/lib/coverband/adapters/file_store.rb +38 -6
- data/lib/coverband/adapters/hash_redis_store.rb +24 -21
- data/lib/coverband/adapters/redis_store.rb +12 -12
- data/lib/coverband/adapters/stdout_store.rb +41 -0
- data/lib/coverband/adapters/web_service_store.rb +155 -0
- data/lib/coverband/at_exit.rb +1 -1
- data/lib/coverband/collectors/coverage.rb +15 -27
- data/lib/coverband/collectors/delta.rb +29 -9
- data/lib/coverband/collectors/view_tracker.rb +10 -10
- data/lib/coverband/collectors/view_tracker_service.rb +59 -0
- data/lib/coverband/configuration.rb +149 -112
- data/lib/coverband/integrations/background.rb +6 -6
- data/lib/coverband/integrations/rack_server_check.rb +3 -3
- data/lib/coverband/reporters/base.rb +11 -12
- data/lib/coverband/reporters/console_report.rb +1 -1
- data/lib/coverband/reporters/html_report.rb +10 -30
- data/lib/coverband/reporters/web.rb +55 -50
- data/lib/coverband/utils/absolute_file_converter.rb +6 -6
- data/lib/coverband/utils/html_formatter.rb +32 -61
- data/lib/coverband/utils/railtie.rb +23 -6
- data/lib/coverband/utils/relative_file_converter.rb +2 -2
- data/lib/coverband/utils/result.rb +6 -11
- data/lib/coverband/utils/results.rb +0 -10
- data/lib/coverband/utils/source_file.rb +21 -30
- data/lib/coverband/utils/tasks.rb +8 -11
- data/lib/coverband/version.rb +1 -1
- data/public/application.js +0 -30
- data/test/benchmarks/benchmark.rake +97 -92
- data/test/benchmarks/dog.rb +1 -1
- data/test/benchmarks/init_rails.rake +4 -4
- data/test/coverband/adapters/base_test.rb +29 -30
- data/test/coverband/adapters/file_store_test.rb +19 -20
- data/test/coverband/adapters/hash_redis_store_test.rb +57 -57
- data/test/coverband/adapters/redis_store_test.rb +26 -26
- data/test/coverband/adapters/web_service_store_test.rb +56 -0
- data/test/coverband/at_exit_test.rb +2 -2
- data/test/coverband/collectors/coverage_test.rb +33 -47
- data/test/coverband/collectors/delta_test.rb +52 -23
- data/test/coverband/collectors/view_tracker_test.rb +35 -35
- data/test/coverband/configuration_test.rb +49 -36
- data/test/coverband/coverband_test.rb +11 -11
- data/test/coverband/integrations/background_middleware_test.rb +10 -10
- data/test/coverband/integrations/background_test.rb +17 -5
- data/test/coverband/integrations/rack_server_check_test.rb +7 -7
- data/test/coverband/integrations/report_middleware_test.rb +9 -9
- data/test/coverband/integrations/resque_worker_test.rb +9 -9
- data/test/coverband/integrations/test_resque_job.rb +1 -1
- data/test/coverband/reporters/base_test.rb +9 -9
- data/test/coverband/reporters/console_test.rb +6 -6
- data/test/coverband/reporters/html_test.rb +36 -48
- data/test/coverband/reporters/web_test.rb +16 -18
- data/test/coverband/utils/absolute_file_converter_test.rb +22 -22
- data/test/coverband/utils/file_hasher_test.rb +6 -12
- data/test/coverband/utils/file_list_test.rb +13 -13
- data/test/coverband/utils/html_formatter_test.rb +9 -23
- data/test/coverband/utils/lines_classifier_test.rb +29 -29
- data/test/coverband/utils/relative_file_converter_test.rb +13 -13
- data/test/coverband/utils/result_test.rb +18 -18
- data/test/coverband/utils/results_test.rb +17 -17
- data/test/coverband/utils/source_file_line_test.rb +46 -46
- data/test/coverband/utils/source_file_test.rb +38 -88
- data/test/dog.rb +1 -1
- data/test/fake_app/basic_rack.rb +2 -2
- data/test/fixtures/app/controllers/sample_controller.rb +1 -1
- data/test/fixtures/app/models/user.rb +1 -1
- data/test/fixtures/sample.rb +1 -1
- data/test/fixtures/utf-8.rb +0 -2
- data/test/forked/rails_full_stack_test.rb +24 -27
- data/test/forked/rails_rake_full_stack_test.rb +7 -26
- data/test/integration/full_stack_test.rb +11 -22
- data/test/jruby_check.rb +2 -3
- data/test/rails4_dummy/Rakefile +1 -1
- data/test/rails4_dummy/config.ru +1 -1
- data/test/rails4_dummy/config/application.rb +4 -4
- data/test/rails4_dummy/config/boot.rb +2 -2
- data/test/rails4_dummy/config/coverband.rb +1 -1
- data/test/rails4_dummy/config/coverband_missing_redis.rb +1 -1
- data/test/rails4_dummy/config/environment.rb +1 -1
- data/test/rails4_dummy/config/routes.rb +2 -2
- data/test/rails5_dummy/Rakefile +1 -1
- data/test/rails5_dummy/config.ru +1 -1
- data/test/rails5_dummy/config/application.rb +3 -3
- data/test/rails5_dummy/config/coverband.rb +8 -8
- data/test/rails5_dummy/config/coverband_missing_redis.rb +8 -8
- data/test/rails5_dummy/config/environment.rb +1 -1
- data/test/rails5_dummy/config/routes.rb +2 -2
- data/test/rails6_dummy/Rakefile +1 -1
- data/test/rails6_dummy/config.ru +1 -1
- data/test/rails6_dummy/config/application.rb +4 -4
- data/test/rails6_dummy/config/boot.rb +2 -2
- data/test/rails6_dummy/config/coverband.rb +1 -1
- data/test/rails6_dummy/config/coverband_missing_redis.rb +1 -1
- data/test/rails6_dummy/config/environment.rb +1 -1
- data/test/rails6_dummy/config/routes.rb +2 -2
- data/test/rails_test_helper.rb +11 -11
- data/test/test_helper.rb +44 -34
- data/test/unique_files.rb +10 -10
- data/views/layout.erb +2 -12
- metadata +28 -34
- data/.rubocop.yml +0 -86
- data/lib/coverband/integrations/bundler.rb +0 -8
- data/lib/coverband/utils/file_groups.rb +0 -53
- data/lib/coverband/utils/gem_list.rb +0 -31
- data/lib/coverband/utils/s3_report.rb +0 -105
- data/test/coverband/utils/file_groups_test.rb +0 -61
- data/test/coverband/utils/gem_list_test.rb +0 -48
- data/test/coverband/utils/s3_report_test.rb +0 -44
- data/views/gem_list.erb +0 -63
@@ -1,57 +1,46 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require File.expand_path(
|
4
|
-
require
|
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 =
|
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
|
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
|
26
|
-
request = Rack::MockRequest.env_for(
|
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
|
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][
|
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][
|
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][
|
41
|
+
Coverband.configuration.store.coverage[@rack_file]["data"]
|
43
42
|
expected = [nil, nil, 1, nil, 1, 1, 0, nil, nil]
|
44
|
-
|
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
|
data/test/jruby_check.rb
CHANGED
data/test/rails4_dummy/Rakefile
CHANGED
@@ -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
|
4
|
+
require_relative "config/application"
|
5
5
|
|
6
6
|
Rails.application.load_tasks
|
data/test/rails4_dummy/config.ru
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require File.expand_path(
|
3
|
+
require File.expand_path("boot", __dir__)
|
4
4
|
|
5
|
-
require
|
6
|
-
require
|
7
|
-
require
|
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[
|
1
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", __FILE__)
|
2
2
|
|
3
|
-
require
|
3
|
+
require "bundler/setup" # Set up gems listed in the Gemfile.
|
data/test/rails5_dummy/Rakefile
CHANGED
@@ -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
|
4
|
+
require_relative "config/application"
|
5
5
|
|
6
6
|
Rails.application.load_tasks
|
data/test/rails5_dummy/config.ru
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
Coverband.configure do |config|
|
4
|
-
config.root
|
5
|
-
config.store
|
6
|
-
config.ignore
|
7
|
-
config.root_paths
|
8
|
-
config.logger
|
9
|
-
config.verbose
|
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[
|
14
|
-
config.simulate_oneshot_lines_coverage = true if ENV[
|
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
|
5
|
-
config.store
|
6
|
-
config.ignore
|
7
|
-
config.root_paths
|
8
|
-
config.logger
|
9
|
-
config.verbose
|
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[
|
14
|
-
config.simulate_oneshot_lines_coverage = true if ENV[
|
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
|
1
|
+
require_relative "application"
|
2
2
|
Rails.application.initialize!
|
data/test/rails6_dummy/Rakefile
CHANGED
@@ -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
|
4
|
+
require_relative "config/application"
|
5
5
|
|
6
6
|
Rails.application.load_tasks
|
data/test/rails6_dummy/config.ru
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require File.expand_path(
|
3
|
+
require File.expand_path("boot", __dir__)
|
4
4
|
|
5
|
-
require
|
6
|
-
require
|
7
|
-
require
|
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[
|
1
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", __FILE__)
|
2
2
|
|
3
|
-
require
|
3
|
+
require "bundler/setup" # Set up gems listed in the Gemfile.
|
data/test/rails_test_helper.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
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
|
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(
|
19
|
-
require
|
20
|
-
require
|
18
|
+
require File.expand_path("./test_helper", File.dirname(__FILE__))
|
19
|
+
require "capybara"
|
20
|
+
require "capybara/minitest"
|
21
21
|
def rails_setup
|
22
|
-
ENV[
|
23
|
-
require
|
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
|
26
|
+
load "coverband/utils/railtie.rb"
|
27
27
|
|
28
28
|
require_relative "../test/rails#{Rails::VERSION::MAJOR}_dummy/config/environment"
|
29
|
-
require
|
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
|
32
|
+
require "mocha/minitest"
|
33
33
|
end
|
data/test/test_helper.rb
CHANGED
@@ -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
|
9
|
-
require
|
10
|
-
require
|
11
|
-
require
|
12
|
-
require
|
13
|
-
require
|
14
|
-
require
|
15
|
-
require
|
16
|
-
require
|
17
|
-
|
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
|
27
|
+
require_relative "unique_files"
|
20
28
|
$VERBOSE = original_verbosity
|
21
29
|
|
22
|
-
unless ENV[
|
30
|
+
unless ENV["ONESHOT"] || ENV["SIMULATE_ONESHOT"]
|
23
31
|
SimpleCov.formatter = Coveralls::SimpleCov::Formatter
|
24
32
|
SimpleCov.start do
|
25
|
-
add_filter
|
33
|
+
add_filter "test/forked"
|
26
34
|
end
|
27
35
|
|
28
36
|
Coveralls.wear!
|
@@ -37,14 +45,16 @@ module Coverband
|
|
37
45
|
end
|
38
46
|
|
39
47
|
def self.reset
|
40
|
-
Coverband.configuration.
|
41
|
-
Coverband.configuration.
|
48
|
+
Coverband.configuration.reset
|
49
|
+
Coverband.configuration.redis_namespace = "coverband_test"
|
50
|
+
Coverband.configuration.store.instance_variable_set(:@redis_namespace, "coverband_test")
|
42
51
|
Coverband.configuration.store.class.class_variable_set(:@@path_cache, {})
|
43
52
|
Coverband.configuration.reset
|
44
53
|
Coverband::Collectors::Coverage.instance.reset_instance
|
45
54
|
Coverband::Utils::RelativeFileConverter.reset
|
46
55
|
Coverband::Utils::AbsoluteFileConverter.reset
|
47
|
-
Coverband.configuration.
|
56
|
+
Coverband.configuration.reporting_wiggle = 0
|
57
|
+
Coverband.configuration.redis_namespace = "coverband_test"
|
48
58
|
Coverband::Background.stop
|
49
59
|
Coverband.configuration.store.instance_variable_set(:@redis, redis)
|
50
60
|
redis.flushdb
|
@@ -61,19 +71,19 @@ Minitest::Test.class_eval do
|
|
61
71
|
prepend Coverband::Test
|
62
72
|
end
|
63
73
|
|
64
|
-
TEST_COVERAGE_FILE =
|
74
|
+
TEST_COVERAGE_FILE = "/tmp/fake_file.json"
|
65
75
|
|
66
|
-
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__),
|
76
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
|
67
77
|
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
68
78
|
|
69
79
|
Mocha::Configuration.prevent(:stubbing_method_unnecessarily)
|
70
80
|
Mocha::Configuration.prevent(:stubbing_non_existent_method)
|
71
81
|
|
72
82
|
def test(name, &block)
|
73
|
-
test_name = "test_#{name.gsub(/\s+/,
|
83
|
+
test_name = "test_#{name.gsub(/\s+/, "_")}".to_sym
|
74
84
|
defined = begin
|
75
85
|
instance_method(test_name)
|
76
|
-
rescue
|
86
|
+
rescue
|
77
87
|
false
|
78
88
|
end
|
79
89
|
raise "#{test_name} is already defined in #{self}" if defined
|
@@ -87,7 +97,7 @@ def test(name, &block)
|
|
87
97
|
end
|
88
98
|
end
|
89
99
|
|
90
|
-
def mock_file_hash(hash:
|
100
|
+
def mock_file_hash(hash: "abcd")
|
91
101
|
Coverband::Utils::FileHasher.expects(:hash).at_least_once.returns(hash)
|
92
102
|
end
|
93
103
|
|
@@ -96,15 +106,15 @@ def example_line
|
|
96
106
|
end
|
97
107
|
|
98
108
|
def basic_coverage
|
99
|
-
{
|
109
|
+
{"app_path/dog.rb" => example_line}
|
100
110
|
end
|
101
111
|
|
102
112
|
def basic_coverage_full_path
|
103
|
-
{
|
113
|
+
{basic_coverage_file_full_path => example_line}
|
104
114
|
end
|
105
115
|
|
106
116
|
def basic_source_fixture_coverage
|
107
|
-
{
|
117
|
+
{source_fixture("sample.rb") => example_line}
|
108
118
|
end
|
109
119
|
|
110
120
|
def basic_coverage_file_full_path
|
@@ -112,11 +122,11 @@ def basic_coverage_file_full_path
|
|
112
122
|
end
|
113
123
|
|
114
124
|
def source_fixture(filename)
|
115
|
-
File.expand_path(File.join(File.dirname(__FILE__),
|
125
|
+
File.expand_path(File.join(File.dirname(__FILE__), "fixtures", filename))
|
116
126
|
end
|
117
127
|
|
118
128
|
def fixtures_root
|
119
|
-
File.expand_path(File.join(File.dirname(__FILE__),
|
129
|
+
File.expand_path(File.join(File.dirname(__FILE__), "fixtures"))
|
120
130
|
end
|
121
131
|
|
122
132
|
def test_root
|
@@ -127,13 +137,13 @@ end
|
|
127
137
|
# This handles an issue where the store is setup in tests prior to being able to set the namespace
|
128
138
|
###
|
129
139
|
def store
|
130
|
-
if Coverband.configuration.store.redis_namespace ==
|
131
|
-
|
140
|
+
if Coverband.configuration.store.redis_namespace == "coverband_test"
|
141
|
+
# noop
|
132
142
|
else
|
133
|
-
Coverband.configuration.redis_namespace =
|
143
|
+
Coverband.configuration.redis_namespace = "coverband_test"
|
134
144
|
Coverband.configuration.instance_variable_set(:@store, nil)
|
135
|
-
Coverband.configuration.store
|
136
145
|
end
|
146
|
+
Coverband.configuration.store
|
137
147
|
end
|
138
148
|
|
139
149
|
# Taken from http://stackoverflow.com/questions/4459330/how-do-i-temporarily-redirect-stderr-in-ruby
|
@@ -150,7 +160,7 @@ ensure
|
|
150
160
|
$stderr = previous_stderr
|
151
161
|
end
|
152
162
|
|
153
|
-
require
|
163
|
+
require "coverband"
|
154
164
|
|
155
165
|
Coverband::Configuration.class_eval do
|
156
166
|
def test_env
|