simplecov 0.13.0 → 0.17.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.md +99 -3
- data/CONTRIBUTING.md +12 -9
- data/ISSUE_TEMPLATE.md +23 -0
- data/{MIT-LICENSE → LICENSE} +1 -1
- data/README.md +90 -43
- data/doc/alternate-formatters.md +21 -1
- data/doc/editor-integration.md +6 -1
- data/lib/simplecov.rb +131 -13
- data/lib/simplecov/command_guesser.rb +2 -0
- data/lib/simplecov/configuration.rb +34 -25
- data/lib/simplecov/defaults.rb +12 -82
- data/lib/simplecov/exit_codes.rb +2 -0
- data/lib/simplecov/file_list.rb +7 -5
- data/lib/simplecov/filter.rb +41 -4
- data/lib/simplecov/formatter.rb +2 -0
- data/lib/simplecov/formatter/multi_formatter.rb +2 -0
- data/lib/simplecov/formatter/simple_formatter.rb +3 -1
- data/lib/simplecov/jruby_fix.rb +2 -0
- data/lib/simplecov/last_run.rb +5 -1
- data/lib/simplecov/lines_classifier.rb +48 -0
- data/lib/simplecov/load_global_config.rb +8 -0
- data/lib/simplecov/no_defaults.rb +2 -0
- data/lib/simplecov/profiles.rb +2 -0
- 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/railtie.rb +2 -0
- data/lib/simplecov/railties/tasks.rake +2 -0
- data/lib/simplecov/raw_coverage.rb +41 -0
- data/lib/simplecov/result.rb +2 -1
- data/lib/simplecov/result_merger.rb +56 -21
- data/lib/simplecov/source_file.rb +43 -34
- data/lib/simplecov/version.rb +3 -23
- metadata +131 -99
- data/.gitignore +0 -31
- data/.rspec +0 -3
- data/.rubocop.yml +0 -84
- data/.travis.yml +0 -32
- data/.yardopts +0 -1
- data/Gemfile +0 -38
- data/Rakefile +0 -41
- 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/cucumber_basic.feature +0 -29
- data/features/maximum_coverage_drop.feature +0 -36
- data/features/merging_test_unit_and_rspec.feature +0 -44
- data/features/minimum_coverage.feature +0 -59
- data/features/refuse_coverage_drop.feature +0 -35
- 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/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/merge_helpers.rb +0 -37
- data/simplecov.gemspec +0 -27
- data/spec/1_8_fallbacks_spec.rb +0 -31
- data/spec/command_guesser_spec.rb +0 -48
- 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 -98
- 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/resultset1.rb +0 -4
- data/spec/fixtures/resultset2.rb +0 -4
- data/spec/fixtures/sample.rb +0 -16
- data/spec/fixtures/utf-8.rb +0 -3
- data/spec/helper.rb +0 -24
- data/spec/merge_helpers_spec.rb +0 -126
- data/spec/multi_formatter_spec.rb +0 -20
- data/spec/result_spec.rb +0 -209
- data/spec/return_codes_spec.rb +0 -34
- data/spec/source_file_line_spec.rb +0 -155
- data/spec/source_file_spec.rb +0 -77
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,84 +0,0 @@
|
|
1
|
-
AllCops:
|
2
|
-
Exclude:
|
3
|
-
- 'spec/fixtures/iso-8859.rb'
|
4
|
-
- 'tmp/**/*'
|
5
|
-
- 'vendor/bundle/**/*'
|
6
|
-
|
7
|
-
Bundler/OrderedGems:
|
8
|
-
Enabled: false
|
9
|
-
|
10
|
-
Lint/AmbiguousRegexpLiteral:
|
11
|
-
Exclude:
|
12
|
-
- 'features/**/*_steps.rb'
|
13
|
-
- 'spec/**/*_steps.rb'
|
14
|
-
- 'tmp/**/*_steps.rb'
|
15
|
-
|
16
|
-
Metrics/AbcSize:
|
17
|
-
Max: 25 # TODO: Lower to 15
|
18
|
-
|
19
|
-
Metrics/BlockLength:
|
20
|
-
Exclude:
|
21
|
-
- 'spec/**/*.rb'
|
22
|
-
|
23
|
-
Metrics/BlockNesting:
|
24
|
-
Max: 2
|
25
|
-
|
26
|
-
Metrics/LineLength:
|
27
|
-
AllowURI: true
|
28
|
-
Enabled: false
|
29
|
-
|
30
|
-
Metrics/MethodLength:
|
31
|
-
CountComments: false
|
32
|
-
Max: 12 # TODO: Lower to 10
|
33
|
-
|
34
|
-
Metrics/ParameterLists:
|
35
|
-
Max: 4
|
36
|
-
CountKeywordArgs: true
|
37
|
-
|
38
|
-
Style/AccessModifierIndentation:
|
39
|
-
EnforcedStyle: outdent
|
40
|
-
|
41
|
-
Style/CollectionMethods:
|
42
|
-
PreferredMethods:
|
43
|
-
map: 'collect'
|
44
|
-
reduce: 'inject'
|
45
|
-
find: 'detect'
|
46
|
-
find_all: 'select'
|
47
|
-
|
48
|
-
Style/Documentation:
|
49
|
-
Enabled: false
|
50
|
-
|
51
|
-
Style/DoubleNegation:
|
52
|
-
Enabled: false
|
53
|
-
|
54
|
-
Style/HashSyntax:
|
55
|
-
EnforcedStyle: hash_rockets
|
56
|
-
|
57
|
-
Style/RegexpLiteral:
|
58
|
-
Enabled: false
|
59
|
-
|
60
|
-
Style/SpaceInsideHashLiteralBraces:
|
61
|
-
EnforcedStyle: no_space
|
62
|
-
|
63
|
-
Style/SpecialGlobalVars:
|
64
|
-
Exclude:
|
65
|
-
- 'spec/deleted_source_spec.rb'
|
66
|
-
- 'spec/return_codes_spec.rb'
|
67
|
-
- 'lib/simplecov/defaults.rb'
|
68
|
-
|
69
|
-
Style/StringLiterals:
|
70
|
-
EnforcedStyle: double_quotes
|
71
|
-
|
72
|
-
Style/FileName:
|
73
|
-
Exclude:
|
74
|
-
- 'spec/fixtures/utf-8.rb'
|
75
|
-
|
76
|
-
Style/TrailingCommaInLiteral:
|
77
|
-
EnforcedStyleForMultiline: comma
|
78
|
-
|
79
|
-
Style/GuardClause:
|
80
|
-
Enabled: false
|
81
|
-
|
82
|
-
Style/MutableConstant:
|
83
|
-
Exclude:
|
84
|
-
- 'lib/simplecov/version.rb' # required for older versions of rubygems
|
data/.travis.yml
DELETED
@@ -1,32 +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.6
|
19
|
-
- 2.3.3
|
20
|
-
- 2.4.0
|
21
|
-
- ruby-head
|
22
|
-
- jruby-head
|
23
|
-
- jruby-9.1.7.0
|
24
|
-
- rbx-2
|
25
|
-
|
26
|
-
matrix:
|
27
|
-
allow_failures:
|
28
|
-
- rvm: ruby-head
|
29
|
-
- rvm: jruby-head
|
30
|
-
- rvm: jruby-9.1.7.0
|
31
|
-
- rvm: rbx-2
|
32
|
-
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.7.4"
|
27
|
-
gem "capybara"
|
28
|
-
gem "nokogiri", RUBY_VERSION < "2.1" ? "~> 1.6.0" : ">= 1.7"
|
29
|
-
gem "cucumber"
|
30
|
-
gem "phantomjs", "~> 1.9"
|
31
|
-
gem "poltergeist"
|
32
|
-
gem "rubocop" 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,41 +0,0 @@
|
|
1
|
-
#!/usr/bin/env rake
|
2
|
-
|
3
|
-
require "rubygems"
|
4
|
-
require "bundler/setup"
|
5
|
-
Bundler::GemHelper.install_tasks
|
6
|
-
|
7
|
-
# See https://github.com/colszowka/simplecov/issues/171
|
8
|
-
desc "Set permissions on all files so they are compatible with both user-local and system-wide installs"
|
9
|
-
task :fix_permissions do
|
10
|
-
system 'bash -c "find . -type f -exec chmod 644 {} \; && find . -type d -exec chmod 755 {} \;"'
|
11
|
-
end
|
12
|
-
# Enforce proper permissions on each build
|
13
|
-
Rake::Task[:build].prerequisites.unshift :fix_permissions
|
14
|
-
|
15
|
-
require "rspec/core/rake_task"
|
16
|
-
RSpec::Core::RakeTask.new(:spec) do |spec|
|
17
|
-
spec.pattern = FileList["spec/*_spec.rb"]
|
18
|
-
end
|
19
|
-
|
20
|
-
begin
|
21
|
-
require "rubocop/rake_task"
|
22
|
-
RuboCop::RakeTask.new
|
23
|
-
rescue LoadError
|
24
|
-
task :rubocop do
|
25
|
-
$stderr.puts "Rubocop is disabled"
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
# Cucumber integration test suite is for impls that work with simplecov only - a.k.a. 1.9+
|
30
|
-
if RUBY_VERSION.start_with? "1.8"
|
31
|
-
task :default => [:spec]
|
32
|
-
else
|
33
|
-
require "cucumber/rake/task"
|
34
|
-
Cucumber::Rake::Task.new
|
35
|
-
|
36
|
-
if RUBY_VERSION.start_with? "1.9"
|
37
|
-
task :default => [:spec, :cucumber]
|
38
|
-
else
|
39
|
-
task :default => [:spec, :cucumber, :rubocop]
|
40
|
-
end
|
41
|
-
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/
|