simplecov 0.15.1 → 0.18.0.beta3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +98 -1
- data/CODE_OF_CONDUCT.md +76 -0
- data/CONTRIBUTING.md +12 -9
- data/ISSUE_TEMPLATE.md +23 -0
- data/{MIT-LICENSE → LICENSE} +0 -0
- data/README.md +300 -115
- data/doc/alternate-formatters.md +20 -0
- data/lib/simplecov.rb +298 -45
- data/lib/simplecov/combine.rb +30 -0
- data/lib/simplecov/combine/branches_combiner.rb +32 -0
- data/lib/simplecov/combine/files_combiner.rb +24 -0
- data/lib/simplecov/combine/lines_combiner.rb +43 -0
- data/lib/simplecov/combine/results_combiner.rb +60 -0
- data/lib/simplecov/command_guesser.rb +8 -3
- data/lib/simplecov/configuration.rb +95 -8
- data/lib/simplecov/defaults.rb +13 -80
- data/lib/simplecov/exit_codes.rb +2 -0
- data/lib/simplecov/file_list.rb +32 -3
- data/lib/simplecov/filter.rb +5 -2
- data/lib/simplecov/formatter.rb +2 -0
- data/lib/simplecov/formatter/multi_formatter.rb +4 -2
- data/lib/simplecov/formatter/simple_formatter.rb +6 -4
- data/lib/simplecov/last_run.rb +5 -1
- data/lib/simplecov/lines_classifier.rb +21 -5
- data/lib/simplecov/load_global_config.rb +2 -0
- data/lib/simplecov/no_defaults.rb +2 -0
- data/lib/simplecov/profiles.rb +11 -7
- data/lib/simplecov/profiles/bundler_filter.rb +5 -0
- data/lib/simplecov/profiles/hidden_filter.rb +5 -0
- data/lib/simplecov/profiles/rails.rb +18 -0
- data/lib/simplecov/profiles/root_filter.rb +10 -0
- data/lib/simplecov/profiles/test_frameworks.rb +8 -0
- data/lib/simplecov/result.rb +41 -6
- data/lib/simplecov/result_adapter.rb +30 -0
- data/lib/simplecov/result_merger.rb +20 -11
- data/lib/simplecov/simulate_coverage.rb +29 -0
- data/lib/simplecov/source_file.rb +190 -109
- data/lib/simplecov/source_file/branch.rb +84 -0
- data/lib/simplecov/source_file/line.rb +72 -0
- data/lib/simplecov/useless_results_remover.rb +16 -0
- data/lib/simplecov/version.rb +3 -1
- metadata +44 -162
- data/.gitignore +0 -31
- data/.rspec +0 -3
- data/.rubocop.yml +0 -88
- data/.travis.yml +0 -29
- data/.yardopts +0 -1
- data/Gemfile +0 -38
- data/Rakefile +0 -39
- data/cucumber.yml +0 -13
- data/features/config_autoload.feature +0 -46
- data/features/config_command_name.feature +0 -45
- data/features/config_coverage_dir.feature +0 -33
- data/features/config_deactivate_merging.feature +0 -42
- data/features/config_formatters.feature +0 -77
- data/features/config_merge_timeout.feature +0 -39
- data/features/config_nocov_token.feature +0 -79
- data/features/config_profiles.feature +0 -44
- data/features/config_project_name.feature +0 -27
- data/features/config_styles.feature +0 -121
- data/features/config_tracked_files.feature +0 -29
- data/features/config_tracked_files_relevant_lines.feature +0 -31
- data/features/cucumber_basic.feature +0 -29
- data/features/maximum_coverage_drop.feature +0 -89
- data/features/merging_test_unit_and_rspec.feature +0 -44
- data/features/minimum_coverage.feature +0 -59
- data/features/refuse_coverage_drop.feature +0 -95
- data/features/rspec_basic.feature +0 -32
- data/features/rspec_fails_on_initialization.feature +0 -14
- data/features/rspec_groups_and_filters_basic.feature +0 -29
- data/features/rspec_groups_and_filters_complex.feature +0 -37
- data/features/rspec_groups_using_filter_class.feature +0 -41
- data/features/rspec_without_simplecov.feature +0 -20
- data/features/skipping_code_blocks_manually.feature +0 -70
- data/features/step_definitions/html_steps.rb +0 -44
- data/features/step_definitions/simplecov_steps.rb +0 -68
- data/features/step_definitions/transformers.rb +0 -13
- data/features/step_definitions/web_steps.rb +0 -64
- data/features/support/aruba_freedom_patch.rb +0 -53
- data/features/support/env.rb +0 -50
- data/features/test_unit_basic.feature +0 -34
- data/features/test_unit_groups_and_filters_basic.feature +0 -29
- data/features/test_unit_groups_and_filters_complex.feature +0 -35
- data/features/test_unit_groups_using_filter_class.feature +0 -40
- data/features/test_unit_without_simplecov.feature +0 -20
- data/features/unicode_compatiblity.feature +0 -67
- data/lib/simplecov/jruby_fix.rb +0 -42
- data/lib/simplecov/railtie.rb +0 -7
- data/lib/simplecov/railties/tasks.rake +0 -11
- data/lib/simplecov/raw_coverage.rb +0 -39
- data/simplecov.gemspec +0 -27
- data/spec/1_8_fallbacks_spec.rb +0 -31
- data/spec/command_guesser_spec.rb +0 -48
- data/spec/config_loader_spec.rb +0 -14
- data/spec/configuration_spec.rb +0 -35
- data/spec/defaults_spec.rb +0 -41
- data/spec/deleted_source_spec.rb +0 -12
- data/spec/faked_project/Gemfile +0 -6
- data/spec/faked_project/Rakefile +0 -8
- data/spec/faked_project/cucumber.yml +0 -13
- data/spec/faked_project/features/step_definitions/my_steps.rb +0 -22
- data/spec/faked_project/features/support/env.rb +0 -12
- data/spec/faked_project/features/test_stuff.feature +0 -6
- data/spec/faked_project/lib/faked_project.rb +0 -11
- data/spec/faked_project/lib/faked_project/framework_specific.rb +0 -18
- data/spec/faked_project/lib/faked_project/meta_magic.rb +0 -24
- data/spec/faked_project/lib/faked_project/some_class.rb +0 -28
- data/spec/faked_project/lib/faked_project/untested_class.rb +0 -11
- data/spec/faked_project/spec/faked_spec.rb +0 -11
- data/spec/faked_project/spec/forking_spec.rb +0 -8
- data/spec/faked_project/spec/meta_magic_spec.rb +0 -15
- data/spec/faked_project/spec/some_class_spec.rb +0 -13
- data/spec/faked_project/spec/spec_helper.rb +0 -11
- data/spec/faked_project/test/faked_test.rb +0 -11
- data/spec/faked_project/test/meta_magic_test.rb +0 -13
- data/spec/faked_project/test/some_class_test.rb +0 -15
- data/spec/faked_project/test/test_helper.rb +0 -12
- data/spec/file_list_spec.rb +0 -50
- data/spec/filters_spec.rb +0 -202
- data/spec/fixtures/app/controllers/sample_controller.rb +0 -10
- data/spec/fixtures/app/models/user.rb +0 -10
- data/spec/fixtures/deleted_source_sample.rb +0 -15
- data/spec/fixtures/frameworks/rspec_bad.rb +0 -9
- data/spec/fixtures/frameworks/rspec_good.rb +0 -9
- data/spec/fixtures/frameworks/testunit_bad.rb +0 -9
- data/spec/fixtures/frameworks/testunit_good.rb +0 -9
- data/spec/fixtures/iso-8859.rb +0 -3
- data/spec/fixtures/never.rb +0 -2
- data/spec/fixtures/resultset1.rb +0 -4
- data/spec/fixtures/resultset2.rb +0 -4
- data/spec/fixtures/sample.rb +0 -16
- data/spec/fixtures/skipped.rb +0 -4
- data/spec/fixtures/skipped_and_executed.rb +0 -8
- data/spec/fixtures/utf-8.rb +0 -3
- data/spec/helper.rb +0 -26
- data/spec/last_run_spec.rb +0 -48
- data/spec/lines_classifier_spec.rb +0 -103
- data/spec/multi_formatter_spec.rb +0 -20
- data/spec/raw_coverage_spec.rb +0 -92
- data/spec/result_merger_spec.rb +0 -171
- data/spec/result_spec.rb +0 -209
- data/spec/return_codes_spec.rb +0 -34
- data/spec/simplecov_spec.rb +0 -109
- data/spec/source_file_line_spec.rb +0 -155
- data/spec/source_file_spec.rb +0 -145
- data/spec/support/fail_rspec_on_ruby_warning.rb +0 -75
@@ -1,20 +0,0 @@
|
|
1
|
-
@test_unit
|
2
|
-
Feature:
|
3
|
-
|
4
|
-
Running unit tests without simplecov configuration
|
5
|
-
|
6
|
-
Scenario: No config at all
|
7
|
-
When I successfully run `bundle exec rake test`
|
8
|
-
Then no coverage report should have been generated
|
9
|
-
|
10
|
-
Scenario: Configured, but not started
|
11
|
-
Given SimpleCov for Test/Unit is configured with:
|
12
|
-
"""
|
13
|
-
require 'simplecov'
|
14
|
-
SimpleCov.configure do
|
15
|
-
add_filter 'somefilter'
|
16
|
-
end
|
17
|
-
"""
|
18
|
-
|
19
|
-
When I successfully run `bundle exec rake test`
|
20
|
-
Then no coverage report should have been generated
|
@@ -1,67 +0,0 @@
|
|
1
|
-
@test_unit @unicode
|
2
|
-
Feature:
|
3
|
-
|
4
|
-
Files with unicode in their source should be no problem at all for
|
5
|
-
generating a proper coverage report.
|
6
|
-
|
7
|
-
Background:
|
8
|
-
Given SimpleCov for Test/Unit is configured with:
|
9
|
-
"""
|
10
|
-
require 'simplecov'
|
11
|
-
SimpleCov.start 'test_frameworks'
|
12
|
-
"""
|
13
|
-
|
14
|
-
Scenario: Snowman inside method string
|
15
|
-
Given a file named "lib/faked_project/unicode.rb" with:
|
16
|
-
"""
|
17
|
-
# encoding: UTF-8
|
18
|
-
class SourceCodeWithUnicode
|
19
|
-
def self.yell!
|
20
|
-
puts "☃"
|
21
|
-
end
|
22
|
-
end
|
23
|
-
"""
|
24
|
-
|
25
|
-
When I open the coverage report generated with `bundle exec rake test`
|
26
|
-
Then I should see the groups:
|
27
|
-
| name | coverage | files |
|
28
|
-
| All Files | 86.67% | 5 |
|
29
|
-
|
30
|
-
And I should see the source files:
|
31
|
-
| name | coverage |
|
32
|
-
| lib/faked_project.rb | 100.0 % |
|
33
|
-
| lib/faked_project/some_class.rb | 80.0 % |
|
34
|
-
| lib/faked_project/framework_specific.rb | 75.0 % |
|
35
|
-
| lib/faked_project/meta_magic.rb | 100.0 % |
|
36
|
-
| lib/faked_project/unicode.rb | 66.67 % |
|
37
|
-
|
38
|
-
And the report should be based upon:
|
39
|
-
| Unit Tests |
|
40
|
-
|
41
|
-
Scenario: Author name in comment
|
42
|
-
Given a file named "lib/faked_project/unicode.rb" with:
|
43
|
-
"""
|
44
|
-
# encoding: UTF-8
|
45
|
-
# author: Javiér Hernández
|
46
|
-
class SomeClassWrittenByAForeigner
|
47
|
-
def self.yell!
|
48
|
-
foo
|
49
|
-
end
|
50
|
-
end
|
51
|
-
"""
|
52
|
-
|
53
|
-
When I open the coverage report generated with `bundle exec rake test`
|
54
|
-
Then I should see the groups:
|
55
|
-
| name | coverage | files |
|
56
|
-
| All Files | 86.67% | 5 |
|
57
|
-
|
58
|
-
And I should see the source files:
|
59
|
-
| name | coverage |
|
60
|
-
| lib/faked_project.rb | 100.0 % |
|
61
|
-
| lib/faked_project/some_class.rb | 80.0 % |
|
62
|
-
| lib/faked_project/framework_specific.rb | 75.0 % |
|
63
|
-
| lib/faked_project/meta_magic.rb | 100.0 % |
|
64
|
-
| lib/faked_project/unicode.rb | 66.67 % |
|
65
|
-
|
66
|
-
And the report should be based upon:
|
67
|
-
| Unit Tests |
|
data/lib/simplecov/jruby_fix.rb
DELETED
@@ -1,42 +0,0 @@
|
|
1
|
-
if defined?(JRUBY_VERSION) && JRUBY_VERSION.to_f < 1.7
|
2
|
-
require "jruby"
|
3
|
-
java_import "org.jruby.ast.NodeType"
|
4
|
-
|
5
|
-
# Coverage for JRuby < 1.7.0 does not work correctly
|
6
|
-
#
|
7
|
-
# - does not distinguish lines that cannot be executed
|
8
|
-
# - does (partial) coverage for files loaded before `Coverage.start`.
|
9
|
-
# - does not expand a path like `lib/../spec` to `spec`.
|
10
|
-
#
|
11
|
-
# This monkey patches Coverage to address those issues
|
12
|
-
module Coverage
|
13
|
-
class << self
|
14
|
-
alias __broken_result__ result
|
15
|
-
|
16
|
-
def result # rubocop:disable Metrics/MethodLength
|
17
|
-
fixed = {}
|
18
|
-
__broken_result__.each do |path, executed_lines|
|
19
|
-
next unless File.file? path
|
20
|
-
|
21
|
-
covered_lines = executed_lines.dup
|
22
|
-
|
23
|
-
process = lambda do |node|
|
24
|
-
if node.node_type == NodeType::NEWLINENODE
|
25
|
-
pos = node.position
|
26
|
-
covered_lines[pos.line] ||= 0
|
27
|
-
end
|
28
|
-
node.child_nodes.each(&process)
|
29
|
-
end
|
30
|
-
|
31
|
-
process[JRuby.parse(File.read(path), path)]
|
32
|
-
|
33
|
-
if (first = covered_lines.detect { |x| x }) && first > 0
|
34
|
-
fixed[File.expand_path(path)] = covered_lines
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
fixed
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
data/lib/simplecov/railtie.rb
DELETED
@@ -1,11 +0,0 @@
|
|
1
|
-
require "rake/testtask"
|
2
|
-
Rake::TestTask.new do |t|
|
3
|
-
t.name = "simplecov"
|
4
|
-
t.loader = :direct # uses require() which skips PWD in Ruby 1.9
|
5
|
-
t.libs.push "test", "spec", Dir.pwd
|
6
|
-
t.test_files = FileList["{test,spec}/**/*_{test,spec}.rb"]
|
7
|
-
t.ruby_opts.push "-r", "simplecov", "-e", "SimpleCov.start(:rails)".inspect
|
8
|
-
end
|
9
|
-
|
10
|
-
require "rake/clean"
|
11
|
-
CLOBBER.include "coverage"
|
@@ -1,39 +0,0 @@
|
|
1
|
-
module SimpleCov
|
2
|
-
module RawCoverage
|
3
|
-
module_function
|
4
|
-
|
5
|
-
# Merges multiple Coverage.result hashes
|
6
|
-
def merge_results(*results)
|
7
|
-
results.reduce({}) do |result, merged|
|
8
|
-
merge_resultsets(result, merged)
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
|
-
# Merges two Coverage.result hashes
|
13
|
-
def merge_resultsets(result1, result2)
|
14
|
-
(result1.keys | result2.keys).each_with_object({}) do |filename, merged|
|
15
|
-
file1 = result1[filename]
|
16
|
-
file2 = result2[filename]
|
17
|
-
merged[filename] = merge_file_coverage(file1, file2)
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
def merge_file_coverage(file1, file2)
|
22
|
-
return (file1 || file2).dup unless file1 && file2
|
23
|
-
|
24
|
-
file1.map.with_index do |count1, index|
|
25
|
-
count2 = file2[index]
|
26
|
-
merge_line_coverage(count1, count2)
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
def merge_line_coverage(count1, count2)
|
31
|
-
sum = count1.to_i + count2.to_i
|
32
|
-
if sum.zero? && (count1.nil? || count2.nil?)
|
33
|
-
nil
|
34
|
-
else
|
35
|
-
sum
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
data/simplecov.gemspec
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
$LOAD_PATH.push File.expand_path("../lib", __FILE__)
|
2
|
-
require "simplecov/version"
|
3
|
-
|
4
|
-
Gem::Specification.new do |gem|
|
5
|
-
gem.name = "simplecov"
|
6
|
-
gem.version = SimpleCov::VERSION
|
7
|
-
gem.platform = Gem::Platform::RUBY
|
8
|
-
gem.authors = ["Christoph Olszowka"]
|
9
|
-
gem.email = ["christoph at olszowka de"]
|
10
|
-
gem.homepage = "http://github.com/colszowka/simplecov"
|
11
|
-
gem.description = %(Code coverage for Ruby 1.9+ with a powerful configuration library and automatic merging of coverage across test suites)
|
12
|
-
gem.summary = gem.description
|
13
|
-
gem.license = "MIT"
|
14
|
-
|
15
|
-
gem.required_ruby_version = ">= 1.8.7"
|
16
|
-
|
17
|
-
gem.add_dependency "json", ">= 1.8", "< 3"
|
18
|
-
gem.add_dependency "simplecov-html", "~> 0.10.0"
|
19
|
-
gem.add_dependency "docile", "~> 1.1.0"
|
20
|
-
|
21
|
-
gem.add_development_dependency "bundler", "~> 1.9"
|
22
|
-
|
23
|
-
gem.files = `git ls-files`.split("\n")
|
24
|
-
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
25
|
-
gem.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
|
26
|
-
gem.require_paths = ["lib"]
|
27
|
-
end
|
data/spec/1_8_fallbacks_spec.rb
DELETED
@@ -1,31 +0,0 @@
|
|
1
|
-
require "helper"
|
2
|
-
|
3
|
-
# Tests that verify that on 1.8 versions of ruby, simplecov simply
|
4
|
-
# does not launch and does not cause errors on the way
|
5
|
-
#
|
6
|
-
# TODO: This should be expanded upon all methods that could potentially
|
7
|
-
# be called in a test/spec-helper simplecov config block
|
8
|
-
#
|
9
|
-
if RUBY_VERSION.start_with? "1.8"
|
10
|
-
describe "Ruby 1.8 fallback" do
|
11
|
-
it "return false when calling SimpleCov.start" do
|
12
|
-
expect(SimpleCov.start).to be false
|
13
|
-
end
|
14
|
-
|
15
|
-
it "return false when calling SimpleCov.start with a block" do
|
16
|
-
expect(SimpleCov.start { raise "Shouldn't reach this!" }).to be false
|
17
|
-
end
|
18
|
-
|
19
|
-
it "return false when calling SimpleCov.configure with a block" do
|
20
|
-
expect(SimpleCov.configure { raise "Shouldn't reach this!" }).to be false
|
21
|
-
end
|
22
|
-
|
23
|
-
it "allow to define a profile" do
|
24
|
-
expect do
|
25
|
-
SimpleCov.profiles.define "testprofile" do
|
26
|
-
add_filter "/config/"
|
27
|
-
end
|
28
|
-
end.not_to raise_error
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
@@ -1,48 +0,0 @@
|
|
1
|
-
require "helper"
|
2
|
-
|
3
|
-
if SimpleCov.usable?
|
4
|
-
describe SimpleCov::CommandGuesser do
|
5
|
-
subject { SimpleCov::CommandGuesser }
|
6
|
-
it 'correctly guesses "Unit Tests" for unit tests' do
|
7
|
-
subject.original_run_command = "/some/path/test/units/foo_bar_test.rb"
|
8
|
-
expect(subject.guess).to eq("Unit Tests")
|
9
|
-
subject.original_run_command = "test/units/foo.rb"
|
10
|
-
expect(subject.guess).to eq("Unit Tests")
|
11
|
-
subject.original_run_command = "test/foo.rb"
|
12
|
-
expect(subject.guess).to eq("Unit Tests")
|
13
|
-
subject.original_run_command = "test/{models,helpers,unit}/**/*_test.rb"
|
14
|
-
expect(subject.guess).to eq("Unit Tests")
|
15
|
-
end
|
16
|
-
|
17
|
-
it 'correctly guesses "Functional Tests" for functional tests' do
|
18
|
-
subject.original_run_command = "/some/path/test/functional/foo_bar_controller_test.rb"
|
19
|
-
expect(subject.guess).to eq("Functional Tests")
|
20
|
-
subject.original_run_command = "test/{controllers,mailers,functional}/**/*_test.rb"
|
21
|
-
expect(subject.guess).to eq("Functional Tests")
|
22
|
-
end
|
23
|
-
|
24
|
-
it 'correctly guesses "Integration Tests" for integration tests' do
|
25
|
-
subject.original_run_command = "/some/path/test/integration/foo_bar_controller_test.rb"
|
26
|
-
expect(subject.guess).to eq("Integration Tests")
|
27
|
-
subject.original_run_command = "test/integration/**/*_test.rb"
|
28
|
-
expect(subject.guess).to eq("Integration Tests")
|
29
|
-
end
|
30
|
-
|
31
|
-
it 'correctly guesses "Cucumber Features" for cucumber features' do
|
32
|
-
subject.original_run_command = "features"
|
33
|
-
expect(subject.guess).to eq("Cucumber Features")
|
34
|
-
subject.original_run_command = "cucumber"
|
35
|
-
expect(subject.guess).to eq("Cucumber Features")
|
36
|
-
end
|
37
|
-
|
38
|
-
it 'correctly guesses "RSpec" for RSpec' do
|
39
|
-
subject.original_run_command = "/some/path/spec/foo.rb"
|
40
|
-
expect(subject.guess).to eq("RSpec")
|
41
|
-
end
|
42
|
-
|
43
|
-
it "defaults to RSpec because RSpec constant is defined" do
|
44
|
-
subject.original_run_command = "some_arbitrary_command with arguments"
|
45
|
-
expect(subject.guess).to eq("RSpec")
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
data/spec/config_loader_spec.rb
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
require "helper"
|
2
|
-
|
3
|
-
describe "loading config" do
|
4
|
-
context "without ENV[HOME]" do
|
5
|
-
it "shouldn't raise any errors" do
|
6
|
-
home = ENV.delete("HOME")
|
7
|
-
begin
|
8
|
-
expect { load "simplecov/load_global_config.rb" }.not_to raise_error
|
9
|
-
ensure
|
10
|
-
ENV["HOME"] = home
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
data/spec/configuration_spec.rb
DELETED
@@ -1,35 +0,0 @@
|
|
1
|
-
require "helper"
|
2
|
-
|
3
|
-
describe SimpleCov::Configuration do
|
4
|
-
let(:config_class) do
|
5
|
-
Class.new do
|
6
|
-
include SimpleCov::Configuration
|
7
|
-
end
|
8
|
-
end
|
9
|
-
let(:config) { config_class.new }
|
10
|
-
|
11
|
-
describe "#tracked_files" do
|
12
|
-
context "when configured" do
|
13
|
-
let(:glob) { "{app,lib}/**/*.rb" }
|
14
|
-
before { config.track_files(glob) }
|
15
|
-
|
16
|
-
it "returns the configured glob" do
|
17
|
-
expect(config.tracked_files).to eq glob
|
18
|
-
end
|
19
|
-
|
20
|
-
context "and configured again with nil" do
|
21
|
-
before { config.track_files(nil) }
|
22
|
-
|
23
|
-
it "returns nil" do
|
24
|
-
expect(config.tracked_files).to be_nil
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
context "when unconfigured" do
|
30
|
-
it "returns nil" do
|
31
|
-
expect(config.tracked_files).to be_nil
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
data/spec/defaults_spec.rb
DELETED
@@ -1,41 +0,0 @@
|
|
1
|
-
require "helper"
|
2
|
-
|
3
|
-
if SimpleCov.usable?
|
4
|
-
describe SimpleCov do
|
5
|
-
skip "requires the default configuration" if ENV["SIMPLECOV_NO_DEFAULTS"]
|
6
|
-
|
7
|
-
context "profiles" do
|
8
|
-
let(:config_class) do
|
9
|
-
Class.new do
|
10
|
-
include SimpleCov::Configuration
|
11
|
-
|
12
|
-
def load_profile(name)
|
13
|
-
configure(&SimpleCov.profiles[name.to_sym])
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
let(:config) { config_class.new }
|
19
|
-
|
20
|
-
def filtered?(config, filename)
|
21
|
-
path = File.join(SimpleCov.root, filename)
|
22
|
-
file = SimpleCov::SourceFile.new(path, [nil, 1, 1, 1, nil, nil, 1, 0, nil, nil])
|
23
|
-
config.filters.any? { |filter| filter.matches?(file) }
|
24
|
-
end
|
25
|
-
|
26
|
-
it "provides a sensible test_frameworks profile" do
|
27
|
-
config.load_profile(:test_frameworks)
|
28
|
-
expect(filtered?(config, "foo.rb")).not_to be
|
29
|
-
expect(filtered?(config, "test/foo.rb")).to be
|
30
|
-
expect(filtered?(config, "spec/bar.rb")).to be
|
31
|
-
end
|
32
|
-
|
33
|
-
it "provides a sensible rails profile" do
|
34
|
-
config.load_profile(:rails)
|
35
|
-
expect(filtered?(config, "app/models/user.rb")).not_to be
|
36
|
-
expect(filtered?(config, "db/schema.rb")).to be
|
37
|
-
expect(filtered?(config, "config/environment.rb")).to be
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
data/spec/deleted_source_spec.rb
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
require "helper"
|
2
|
-
|
3
|
-
# Test to verify correct handling of deleted files
|
4
|
-
# See https://github.com/colszowka/simplecov/issues/9
|
5
|
-
describe "A source file which is subsequently deleted" do
|
6
|
-
it "does not cause an error" do
|
7
|
-
Dir.chdir(File.join(File.dirname(__FILE__), "fixtures")) do
|
8
|
-
`ruby deleted_source_sample.rb`
|
9
|
-
expect($?.exitstatus).to be_zero
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|
data/spec/faked_project/Gemfile
DELETED
data/spec/faked_project/Rakefile
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
<%
|
2
|
-
rerun = File.file?('rerun.txt') ? IO.read('rerun.txt') : ""
|
3
|
-
rerun_opts = rerun.to_s.strip.empty? ? "--format #{ENV['CUCUMBER_FORMAT'] || 'progress'} features" : "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} #{rerun}"
|
4
|
-
std_opts = "--format #{ENV['CUCUMBER_FORMAT'] || 'progress'} --strict --tags ~@wip"
|
5
|
-
interp_opts = if defined?(RUBY_ENGINE)
|
6
|
-
" --tags ~@exclude-#{RUBY_ENGINE}"
|
7
|
-
else
|
8
|
-
''
|
9
|
-
end
|
10
|
-
%>
|
11
|
-
default: <%= std_opts %><%= interp_opts %> features
|
12
|
-
wip: --tags @wip:30 --wip features<%= interp_opts %>
|
13
|
-
rerun: <%= rerun_opts %> --format rerun --out rerun.txt --strict --tags ~@wip<%= interp_opts %>
|