simplecov 0.15.1 → 0.18.0.beta2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +89 -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 +100 -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 +13 -4
- 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
data/.gitignore
DELETED
@@ -1,31 +0,0 @@
|
|
1
|
-
.bundle
|
2
|
-
Gemfile.lock
|
3
|
-
gemfiles/*.lock
|
4
|
-
|
5
|
-
## MAC OS
|
6
|
-
.DS_Store
|
7
|
-
.document
|
8
|
-
|
9
|
-
## TEXTMATE
|
10
|
-
*.tmproj
|
11
|
-
tmtags
|
12
|
-
|
13
|
-
## EMACS
|
14
|
-
*~
|
15
|
-
\#*
|
16
|
-
.\#*
|
17
|
-
|
18
|
-
## VIM
|
19
|
-
*.swp
|
20
|
-
|
21
|
-
## PROJECT::GENERAL
|
22
|
-
coverage
|
23
|
-
rdoc
|
24
|
-
pkg
|
25
|
-
tmp
|
26
|
-
capybara*.html
|
27
|
-
.rvmrc
|
28
|
-
|
29
|
-
## PROJECT::SPECIFIC
|
30
|
-
|
31
|
-
.yardoc
|
data/.rspec
DELETED
data/.rubocop.yml
DELETED
@@ -1,88 +0,0 @@
|
|
1
|
-
AllCops:
|
2
|
-
Exclude:
|
3
|
-
- 'spec/fixtures/iso-8859.rb'
|
4
|
-
- 'tmp/**/*'
|
5
|
-
- 'vendor/bundle/**/*'
|
6
|
-
TargetRubyVersion: 1.9
|
7
|
-
|
8
|
-
Bundler/OrderedGems:
|
9
|
-
Enabled: false
|
10
|
-
|
11
|
-
Lint/AmbiguousRegexpLiteral:
|
12
|
-
Exclude:
|
13
|
-
- 'features/**/*_steps.rb'
|
14
|
-
- 'spec/**/*_steps.rb'
|
15
|
-
- 'tmp/**/*_steps.rb'
|
16
|
-
|
17
|
-
Metrics/AbcSize:
|
18
|
-
Max: 25 # TODO: Lower to 15
|
19
|
-
|
20
|
-
Metrics/BlockLength:
|
21
|
-
Exclude:
|
22
|
-
- 'spec/**/*.rb'
|
23
|
-
|
24
|
-
Metrics/BlockNesting:
|
25
|
-
Max: 2
|
26
|
-
|
27
|
-
Metrics/LineLength:
|
28
|
-
AllowURI: true
|
29
|
-
Enabled: false
|
30
|
-
|
31
|
-
Metrics/MethodLength:
|
32
|
-
CountComments: false
|
33
|
-
Max: 12 # TODO: Lower to 10
|
34
|
-
|
35
|
-
Metrics/ParameterLists:
|
36
|
-
Max: 4
|
37
|
-
CountKeywordArgs: true
|
38
|
-
|
39
|
-
Layout/AccessModifierIndentation:
|
40
|
-
EnforcedStyle: outdent
|
41
|
-
|
42
|
-
Style/CollectionMethods:
|
43
|
-
PreferredMethods:
|
44
|
-
map: 'collect'
|
45
|
-
reduce: 'inject'
|
46
|
-
find: 'detect'
|
47
|
-
find_all: 'select'
|
48
|
-
|
49
|
-
Style/Documentation:
|
50
|
-
Enabled: false
|
51
|
-
|
52
|
-
Style/DoubleNegation:
|
53
|
-
Enabled: false
|
54
|
-
|
55
|
-
Style/HashSyntax:
|
56
|
-
EnforcedStyle: hash_rockets
|
57
|
-
|
58
|
-
Layout/IndentHeredoc:
|
59
|
-
Enabled: false
|
60
|
-
|
61
|
-
Style/RegexpLiteral:
|
62
|
-
Enabled: false
|
63
|
-
|
64
|
-
Layout/SpaceInsideHashLiteralBraces:
|
65
|
-
EnforcedStyle: no_space
|
66
|
-
|
67
|
-
Style/SpecialGlobalVars:
|
68
|
-
Exclude:
|
69
|
-
- 'spec/deleted_source_spec.rb'
|
70
|
-
- 'spec/return_codes_spec.rb'
|
71
|
-
- 'lib/simplecov/defaults.rb'
|
72
|
-
|
73
|
-
Style/StringLiterals:
|
74
|
-
EnforcedStyle: double_quotes
|
75
|
-
|
76
|
-
Style/FileName:
|
77
|
-
Exclude:
|
78
|
-
- 'spec/fixtures/utf-8.rb'
|
79
|
-
|
80
|
-
Style/TrailingCommaInLiteral:
|
81
|
-
EnforcedStyleForMultiline: comma
|
82
|
-
|
83
|
-
Style/GuardClause:
|
84
|
-
Enabled: false
|
85
|
-
|
86
|
-
Style/MutableConstant:
|
87
|
-
Exclude:
|
88
|
-
- 'lib/simplecov/version.rb' # required for older versions of rubygems
|
data/.travis.yml
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
language: ruby
|
2
|
-
|
3
|
-
before_install:
|
4
|
-
- gem update --system
|
5
|
-
- gem install bundler
|
6
|
-
|
7
|
-
bundler_args: --without development --jobs=3 --retry=3
|
8
|
-
|
9
|
-
cache: bundler
|
10
|
-
|
11
|
-
sudo: false
|
12
|
-
|
13
|
-
rvm:
|
14
|
-
- 1.8.7
|
15
|
-
- 1.9.3
|
16
|
-
- 2.0.0
|
17
|
-
- 2.1.10
|
18
|
-
- 2.2.7
|
19
|
-
- 2.3.4
|
20
|
-
- 2.4.1
|
21
|
-
- jruby-9.1.13.0
|
22
|
-
- ruby-head
|
23
|
-
- jruby-head
|
24
|
-
|
25
|
-
matrix:
|
26
|
-
allow_failures:
|
27
|
-
- rvm: ruby-head
|
28
|
-
- rvm: jruby-head
|
29
|
-
fast_finish: true
|
data/.yardopts
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
- **/*.md
|
data/Gemfile
DELETED
@@ -1,38 +0,0 @@
|
|
1
|
-
source "https://rubygems.org"
|
2
|
-
|
3
|
-
# Uncomment this to use local copy of simplecov-html in development when checked out
|
4
|
-
# gem 'simplecov-html', :path => ::File.dirname(__FILE__) + '/../simplecov-html'
|
5
|
-
|
6
|
-
# Uncomment this to use development version of html formatter from github
|
7
|
-
# gem 'simplecov-html', :github => 'colszowka/simplecov-html'
|
8
|
-
|
9
|
-
gem "rake", Gem::Version.new(RUBY_VERSION) < Gem::Version.new("1.9.3") ? "~>10.3" : ">= 10.3"
|
10
|
-
|
11
|
-
group :test do
|
12
|
-
gem "rspec", ">= 3.2"
|
13
|
-
# Older versions of some gems required for Ruby 1.8.7 support
|
14
|
-
platforms :ruby_18 do
|
15
|
-
gem "activesupport", "~> 3.2.21"
|
16
|
-
gem "i18n", "~> 0.6.11"
|
17
|
-
end
|
18
|
-
platforms :ruby_18, :ruby_19 do
|
19
|
-
gem "mime-types", "~> 1.25"
|
20
|
-
gem "addressable", "~> 2.3.0"
|
21
|
-
end
|
22
|
-
platforms :ruby_18, :ruby_19, :ruby_20, :ruby_21 do
|
23
|
-
gem "rack", "~> 1.6"
|
24
|
-
end
|
25
|
-
platforms :jruby, :ruby_19, :ruby_20, :ruby_21, :ruby_22, :ruby_23, :ruby_24, :ruby_25 do
|
26
|
-
gem "aruba", "~> 0.14"
|
27
|
-
gem "capybara"
|
28
|
-
gem "nokogiri", RUBY_VERSION < "2.1" ? "~> 1.6.0" : ">= 1.7"
|
29
|
-
gem "cucumber"
|
30
|
-
gem "phantomjs", "~> 2.1"
|
31
|
-
gem "poltergeist"
|
32
|
-
gem "rubocop", "0.49.1" unless RUBY_VERSION.start_with?("1.")
|
33
|
-
gem "test-unit"
|
34
|
-
end
|
35
|
-
gem "json", RUBY_VERSION.start_with?("1.") ? "~> 1.8" : "~> 2.0"
|
36
|
-
end
|
37
|
-
|
38
|
-
gemspec
|
data/Rakefile
DELETED
@@ -1,39 +0,0 @@
|
|
1
|
-
require "rubygems"
|
2
|
-
require "bundler/setup"
|
3
|
-
Bundler::GemHelper.install_tasks
|
4
|
-
|
5
|
-
# See https://github.com/colszowka/simplecov/issues/171
|
6
|
-
desc "Set permissions on all files so they are compatible with both user-local and system-wide installs"
|
7
|
-
task :fix_permissions do
|
8
|
-
system 'bash -c "find . -type f -exec chmod 644 {} \; && find . -type d -exec chmod 755 {} \;"'
|
9
|
-
end
|
10
|
-
# Enforce proper permissions on each build
|
11
|
-
Rake::Task[:build].prerequisites.unshift :fix_permissions
|
12
|
-
|
13
|
-
require "rspec/core/rake_task"
|
14
|
-
RSpec::Core::RakeTask.new(:spec) do |spec|
|
15
|
-
spec.pattern = FileList["spec/*_spec.rb"]
|
16
|
-
end
|
17
|
-
|
18
|
-
begin
|
19
|
-
require "rubocop/rake_task"
|
20
|
-
RuboCop::RakeTask.new
|
21
|
-
rescue LoadError
|
22
|
-
task :rubocop do
|
23
|
-
$stderr.puts "Rubocop is disabled"
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
# Cucumber integration test suite is for impls that work with simplecov only - a.k.a. 1.9+
|
28
|
-
if RUBY_VERSION.start_with? "1.8"
|
29
|
-
task :default => [:spec]
|
30
|
-
else
|
31
|
-
require "cucumber/rake/task"
|
32
|
-
Cucumber::Rake::Task.new
|
33
|
-
|
34
|
-
if RUBY_VERSION.start_with? "1.9"
|
35
|
-
task :default => [:spec, :cucumber]
|
36
|
-
else
|
37
|
-
task :default => [:rubocop, :spec, :cucumber]
|
38
|
-
end
|
39
|
-
end
|
data/cucumber.yml
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 %>
|
@@ -1,46 +0,0 @@
|
|
1
|
-
@test_unit @rspec @config
|
2
|
-
Feature:
|
3
|
-
|
4
|
-
If you have multiple test suites, it can be a bit cumbersome
|
5
|
-
to keep the configuration across them in sync. SimpleCov
|
6
|
-
is able to find a config file called '.simplecov' that resides
|
7
|
-
in your project's root and will automatically use it when
|
8
|
-
loaded.
|
9
|
-
|
10
|
-
This gives you the ability to configure SimpleCov just once
|
11
|
-
and then use the same configuration on all test suites simply
|
12
|
-
by doing a 'require "simplecov"'
|
13
|
-
|
14
|
-
Scenario:
|
15
|
-
Given a file named ".simplecov" with:
|
16
|
-
"""
|
17
|
-
SimpleCov.start do
|
18
|
-
add_filter 'test.rb'
|
19
|
-
add_filter 'spec.rb'
|
20
|
-
end
|
21
|
-
"""
|
22
|
-
Given SimpleCov for Test/Unit is configured with:
|
23
|
-
"""
|
24
|
-
require 'simplecov'
|
25
|
-
"""
|
26
|
-
Given SimpleCov for RSpec is configured with:
|
27
|
-
"""
|
28
|
-
require 'simplecov'
|
29
|
-
"""
|
30
|
-
|
31
|
-
When I successfully run `bundle exec rake test`
|
32
|
-
And I open the coverage report generated with `bundle exec rspec spec`
|
33
|
-
Then the report should be based upon:
|
34
|
-
| RSpec |
|
35
|
-
| Unit Tests |
|
36
|
-
|
37
|
-
And I should see the groups:
|
38
|
-
| name | coverage | files |
|
39
|
-
| All Files | 90.48% | 4 |
|
40
|
-
|
41
|
-
And I should see the source files:
|
42
|
-
| name | coverage |
|
43
|
-
| lib/faked_project.rb | 100.0 % |
|
44
|
-
| lib/faked_project/some_class.rb | 80.0 % |
|
45
|
-
| lib/faked_project/framework_specific.rb | 87.5 % |
|
46
|
-
| lib/faked_project/meta_magic.rb | 100.0 % |
|
@@ -1,45 +0,0 @@
|
|
1
|
-
@test_unit @rspec @merging @config
|
2
|
-
Feature: Custom names for individual test suites
|
3
|
-
|
4
|
-
Each test suite needs a name it can be identified by. SimpleCov tries
|
5
|
-
best to detect Rails' Unit, Functional, Integration tests as well as regular
|
6
|
-
Test/Unit, RSpec and Cucumber, but if that is insufficient, each test suite
|
7
|
-
config can be given a custom command name using SimpleCov.command_name.
|
8
|
-
|
9
|
-
Scenario:
|
10
|
-
Given SimpleCov for Test/Unit is configured with:
|
11
|
-
"""
|
12
|
-
require 'simplecov'
|
13
|
-
SimpleCov.start do
|
14
|
-
command_name "I'm in UR Unitz"
|
15
|
-
end
|
16
|
-
"""
|
17
|
-
Given SimpleCov for RSpec is configured with:
|
18
|
-
"""
|
19
|
-
require 'simplecov'
|
20
|
-
SimpleCov.start do
|
21
|
-
command_name "Dreck macht Speck"
|
22
|
-
end
|
23
|
-
"""
|
24
|
-
|
25
|
-
When I open the coverage report generated with `bundle exec rake test`
|
26
|
-
Then the report should be based upon:
|
27
|
-
| I'm in UR Unitz |
|
28
|
-
|
29
|
-
When I open the coverage report generated with `bundle exec rspec spec`
|
30
|
-
Then the report should be based upon:
|
31
|
-
| Dreck macht Speck |
|
32
|
-
| I'm in UR Unitz |
|
33
|
-
|
34
|
-
Scenario: RSpec auto detection with spec/features
|
35
|
-
Given SimpleCov for RSpec is configured with:
|
36
|
-
"""
|
37
|
-
require 'simplecov'
|
38
|
-
SimpleCov.start
|
39
|
-
"""
|
40
|
-
And a file named "spec/features/foobar_spec.rb" with:
|
41
|
-
"""
|
42
|
-
"""
|
43
|
-
When I open the coverage report generated with `bundle exec rspec spec`
|
44
|
-
Then the report should be based upon:
|
45
|
-
| RSpec |
|
@@ -1,33 +0,0 @@
|
|
1
|
-
@test_unit @config
|
2
|
-
Feature:
|
3
|
-
|
4
|
-
The output directory for test coverage can be customized
|
5
|
-
with the SimpleCov.coverage_dir setting. All coverage reports
|
6
|
-
will be put there instead of the default 'coverage' directory
|
7
|
-
in your project's root.
|
8
|
-
|
9
|
-
Scenario:
|
10
|
-
Given SimpleCov for Test/Unit is configured with:
|
11
|
-
"""
|
12
|
-
require 'simplecov'
|
13
|
-
SimpleCov.start do
|
14
|
-
coverage_dir 'test/simplecov'
|
15
|
-
end
|
16
|
-
"""
|
17
|
-
|
18
|
-
When I successfully run `bundle exec rake test`
|
19
|
-
Then a coverage report should have been generated in "test/simplecov"
|
20
|
-
And a directory named "coverage" should not exist
|
21
|
-
|
22
|
-
Scenario:
|
23
|
-
Given SimpleCov for Test/Unit is configured with:
|
24
|
-
"""
|
25
|
-
require 'simplecov'
|
26
|
-
SimpleCov.start do
|
27
|
-
coverage_dir '/tmp/test/simplecov'
|
28
|
-
end
|
29
|
-
"""
|
30
|
-
|
31
|
-
When I successfully run `bundle exec rake test`
|
32
|
-
Then a coverage report should have been generated in "/tmp/test/simplecov"
|
33
|
-
And a directory named "coverage" should not exist
|
@@ -1,42 +0,0 @@
|
|
1
|
-
@test_unit @rspec @merging @config
|
2
|
-
Feature:
|
3
|
-
|
4
|
-
If merging of test suite results is not desired, it can be deactivated,
|
5
|
-
thus leading to the coverage report being overwritten with the latest results
|
6
|
-
of a single test suite on each run of any suite.
|
7
|
-
|
8
|
-
It's probably preferrable to generate the individual suite results into separate
|
9
|
-
output directories instead (see SimpleCov.coverage_dir), but it is possible :)
|
10
|
-
|
11
|
-
Scenario:
|
12
|
-
Given SimpleCov for Test/Unit is configured with:
|
13
|
-
"""
|
14
|
-
require 'simplecov'
|
15
|
-
SimpleCov.start do
|
16
|
-
use_merging false
|
17
|
-
end
|
18
|
-
"""
|
19
|
-
Given SimpleCov for RSpec is configured with:
|
20
|
-
"""
|
21
|
-
require 'simplecov'
|
22
|
-
SimpleCov.start do
|
23
|
-
use_merging false
|
24
|
-
end
|
25
|
-
"""
|
26
|
-
|
27
|
-
When I successfully run `bundle exec rake test`
|
28
|
-
Then a file named "coverage/index.html" should exist
|
29
|
-
But a file named "coverage/.resultset.json" should not exist
|
30
|
-
|
31
|
-
Given I open the coverage report
|
32
|
-
Then the report should be based upon:
|
33
|
-
| Unit Tests |
|
34
|
-
|
35
|
-
When I successfully run `bundle exec rspec spec`
|
36
|
-
Then a file named "coverage/index.html" should exist
|
37
|
-
But a file named "coverage/.resultset.json" should not exist
|
38
|
-
|
39
|
-
Given I open the coverage report
|
40
|
-
Then the report should be based upon:
|
41
|
-
| RSpec |
|
42
|
-
|
@@ -1,77 +0,0 @@
|
|
1
|
-
@test_unit @config
|
2
|
-
Feature:
|
3
|
-
|
4
|
-
The formatter for test coverage can be customized
|
5
|
-
with the SimpleCov.formatter setting. There are two
|
6
|
-
built-in formatters:
|
7
|
-
SimpleCov::Formatter::SimpleFormatter is a simple
|
8
|
-
formatter returning a string of all files with
|
9
|
-
theirs coverages.
|
10
|
-
SimpleCov::Formatter::MultiFormatter is a formatter
|
11
|
-
used to call multiple formatters at once.
|
12
|
-
|
13
|
-
Scenario: With SimpleFormatter
|
14
|
-
Given SimpleCov for Test/Unit is configured with:
|
15
|
-
"""
|
16
|
-
require 'simplecov'
|
17
|
-
SimpleCov.formatter = SimpleCov::Formatter::SimpleFormatter
|
18
|
-
SimpleCov.at_exit do
|
19
|
-
puts SimpleCov.result.format!
|
20
|
-
end
|
21
|
-
SimpleCov.start do
|
22
|
-
add_group 'Libs', 'lib/faked_project/'
|
23
|
-
end
|
24
|
-
"""
|
25
|
-
|
26
|
-
When I successfully run `bundle exec rake test`
|
27
|
-
Then the output should contain "lib/faked_project/meta_magic.rb (coverage: 100.0%)"
|
28
|
-
|
29
|
-
Scenario: With MultiFormatter
|
30
|
-
Given SimpleCov for Test/Unit is configured with:
|
31
|
-
"""
|
32
|
-
require 'simplecov'
|
33
|
-
SimpleCov.formatters = [
|
34
|
-
SimpleCov::Formatter::SimpleFormatter,
|
35
|
-
Class.new do
|
36
|
-
def format(result)
|
37
|
-
raise "Unable to format"
|
38
|
-
end
|
39
|
-
end
|
40
|
-
]
|
41
|
-
|
42
|
-
SimpleCov.at_exit do
|
43
|
-
puts SimpleCov.result.format!.join
|
44
|
-
end
|
45
|
-
SimpleCov.start do
|
46
|
-
add_group 'Libs', 'lib/faked_project/'
|
47
|
-
end
|
48
|
-
"""
|
49
|
-
|
50
|
-
When I successfully run `bundle exec rake test`
|
51
|
-
Then the output should contain "lib/faked_project/meta_magic.rb (coverage: 100.0%)"
|
52
|
-
And the output should match /Formatter [^\s]* failed with RuntimeError: Unable to format/
|
53
|
-
|
54
|
-
Scenario: With multiple formatters
|
55
|
-
Given SimpleCov for Test/Unit is configured with:
|
56
|
-
"""
|
57
|
-
require 'simplecov'
|
58
|
-
SimpleCov.formatters = [
|
59
|
-
SimpleCov::Formatter::SimpleFormatter,
|
60
|
-
Class.new do
|
61
|
-
def format(result)
|
62
|
-
raise "Unable to format"
|
63
|
-
end
|
64
|
-
end
|
65
|
-
]
|
66
|
-
|
67
|
-
SimpleCov.at_exit do
|
68
|
-
puts SimpleCov.result.format!.join
|
69
|
-
end
|
70
|
-
SimpleCov.start do
|
71
|
-
add_group 'Libs', 'lib/faked_project/'
|
72
|
-
end
|
73
|
-
"""
|
74
|
-
|
75
|
-
When I successfully run `bundle exec rake test`
|
76
|
-
Then the output should contain "lib/faked_project/meta_magic.rb (coverage: 100.0%)"
|
77
|
-
And the output should match /Formatter [^\s]* failed with RuntimeError: Unable to format/
|