simplecov-patched 0.14.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (126) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +31 -0
  3. data/.rspec +3 -0
  4. data/.rubocop.yml +88 -0
  5. data/.travis.yml +29 -0
  6. data/.yardopts +1 -0
  7. data/CHANGELOG.md +435 -0
  8. data/CONTRIBUTING.md +48 -0
  9. data/Gemfile +38 -0
  10. data/MIT-LICENSE +20 -0
  11. data/README.md +646 -0
  12. data/Rakefile +41 -0
  13. data/cucumber.yml +13 -0
  14. data/doc/alternate-formatters.md +36 -0
  15. data/doc/commercial-services.md +20 -0
  16. data/doc/editor-integration.md +13 -0
  17. data/features/config_autoload.feature +46 -0
  18. data/features/config_command_name.feature +45 -0
  19. data/features/config_coverage_dir.feature +33 -0
  20. data/features/config_deactivate_merging.feature +42 -0
  21. data/features/config_formatters.feature +77 -0
  22. data/features/config_merge_timeout.feature +39 -0
  23. data/features/config_nocov_token.feature +79 -0
  24. data/features/config_profiles.feature +44 -0
  25. data/features/config_project_name.feature +27 -0
  26. data/features/config_styles.feature +121 -0
  27. data/features/config_tracked_files.feature +29 -0
  28. data/features/cucumber_basic.feature +29 -0
  29. data/features/maximum_coverage_drop.feature +89 -0
  30. data/features/merging_test_unit_and_rspec.feature +44 -0
  31. data/features/minimum_coverage.feature +59 -0
  32. data/features/refuse_coverage_drop.feature +95 -0
  33. data/features/rspec_basic.feature +32 -0
  34. data/features/rspec_fails_on_initialization.feature +14 -0
  35. data/features/rspec_groups_and_filters_basic.feature +29 -0
  36. data/features/rspec_groups_and_filters_complex.feature +37 -0
  37. data/features/rspec_groups_using_filter_class.feature +41 -0
  38. data/features/rspec_without_simplecov.feature +20 -0
  39. data/features/skipping_code_blocks_manually.feature +70 -0
  40. data/features/step_definitions/html_steps.rb +44 -0
  41. data/features/step_definitions/simplecov_steps.rb +68 -0
  42. data/features/step_definitions/transformers.rb +13 -0
  43. data/features/step_definitions/web_steps.rb +64 -0
  44. data/features/support/env.rb +50 -0
  45. data/features/test_unit_basic.feature +34 -0
  46. data/features/test_unit_groups_and_filters_basic.feature +29 -0
  47. data/features/test_unit_groups_and_filters_complex.feature +35 -0
  48. data/features/test_unit_groups_using_filter_class.feature +40 -0
  49. data/features/test_unit_without_simplecov.feature +20 -0
  50. data/features/unicode_compatiblity.feature +67 -0
  51. data/lib/simplecov.rb +189 -0
  52. data/lib/simplecov/command_guesser.rb +59 -0
  53. data/lib/simplecov/configuration.rb +307 -0
  54. data/lib/simplecov/defaults.rb +121 -0
  55. data/lib/simplecov/exit_codes.rb +8 -0
  56. data/lib/simplecov/file_list.rb +59 -0
  57. data/lib/simplecov/filter.rb +54 -0
  58. data/lib/simplecov/formatter.rb +8 -0
  59. data/lib/simplecov/formatter/multi_formatter.rb +32 -0
  60. data/lib/simplecov/formatter/simple_formatter.rb +23 -0
  61. data/lib/simplecov/jruby_fix.rb +42 -0
  62. data/lib/simplecov/last_run.rb +24 -0
  63. data/lib/simplecov/load_global_config.rb +6 -0
  64. data/lib/simplecov/no_defaults.rb +2 -0
  65. data/lib/simplecov/profiles.rb +31 -0
  66. data/lib/simplecov/railtie.rb +7 -0
  67. data/lib/simplecov/railties/tasks.rake +11 -0
  68. data/lib/simplecov/raw_coverage.rb +39 -0
  69. data/lib/simplecov/result.rb +86 -0
  70. data/lib/simplecov/result_merger.rb +95 -0
  71. data/lib/simplecov/source_file.rb +196 -0
  72. data/lib/simplecov/version.rb +25 -0
  73. data/spec/1_8_fallbacks_spec.rb +31 -0
  74. data/spec/command_guesser_spec.rb +48 -0
  75. data/spec/config_loader_spec.rb +14 -0
  76. data/spec/configuration_spec.rb +35 -0
  77. data/spec/deleted_source_spec.rb +12 -0
  78. data/spec/faked_project/Gemfile +6 -0
  79. data/spec/faked_project/Rakefile +8 -0
  80. data/spec/faked_project/cucumber.yml +13 -0
  81. data/spec/faked_project/features/step_definitions/my_steps.rb +22 -0
  82. data/spec/faked_project/features/support/env.rb +12 -0
  83. data/spec/faked_project/features/test_stuff.feature +6 -0
  84. data/spec/faked_project/lib/faked_project.rb +11 -0
  85. data/spec/faked_project/lib/faked_project/framework_specific.rb +18 -0
  86. data/spec/faked_project/lib/faked_project/meta_magic.rb +24 -0
  87. data/spec/faked_project/lib/faked_project/some_class.rb +28 -0
  88. data/spec/faked_project/lib/faked_project/untested_class.rb +11 -0
  89. data/spec/faked_project/spec/faked_spec.rb +11 -0
  90. data/spec/faked_project/spec/forking_spec.rb +8 -0
  91. data/spec/faked_project/spec/meta_magic_spec.rb +15 -0
  92. data/spec/faked_project/spec/some_class_spec.rb +13 -0
  93. data/spec/faked_project/spec/spec_helper.rb +11 -0
  94. data/spec/faked_project/test/faked_test.rb +11 -0
  95. data/spec/faked_project/test/meta_magic_test.rb +13 -0
  96. data/spec/faked_project/test/some_class_test.rb +15 -0
  97. data/spec/faked_project/test/test_helper.rb +12 -0
  98. data/spec/file_list_spec.rb +50 -0
  99. data/spec/filters_spec.rb +98 -0
  100. data/spec/fixtures/app/controllers/sample_controller.rb +10 -0
  101. data/spec/fixtures/app/models/user.rb +10 -0
  102. data/spec/fixtures/deleted_source_sample.rb +15 -0
  103. data/spec/fixtures/frameworks/rspec_bad.rb +9 -0
  104. data/spec/fixtures/frameworks/rspec_good.rb +9 -0
  105. data/spec/fixtures/frameworks/testunit_bad.rb +9 -0
  106. data/spec/fixtures/frameworks/testunit_good.rb +9 -0
  107. data/spec/fixtures/iso-8859.rb +3 -0
  108. data/spec/fixtures/never.rb +2 -0
  109. data/spec/fixtures/resultset1.rb +4 -0
  110. data/spec/fixtures/resultset2.rb +4 -0
  111. data/spec/fixtures/sample.rb +16 -0
  112. data/spec/fixtures/skipped.rb +4 -0
  113. data/spec/fixtures/skipped_and_executed.rb +8 -0
  114. data/spec/fixtures/utf-8.rb +3 -0
  115. data/spec/helper.rb +26 -0
  116. data/spec/last_run_spec.rb +48 -0
  117. data/spec/multi_formatter_spec.rb +20 -0
  118. data/spec/raw_coverage_spec.rb +92 -0
  119. data/spec/result_merger_spec.rb +96 -0
  120. data/spec/result_spec.rb +209 -0
  121. data/spec/return_codes_spec.rb +34 -0
  122. data/spec/simplecov_spec.rb +110 -0
  123. data/spec/source_file_line_spec.rb +155 -0
  124. data/spec/source_file_spec.rb +141 -0
  125. data/spec/support/fail_rspec_on_ruby_warning.rb +75 -0
  126. metadata +320 -0
data/Rakefile ADDED
@@ -0,0 +1,41 @@
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 => [:rubocop, :spec, :cucumber]
40
+ end
41
+ end
data/cucumber.yml ADDED
@@ -0,0 +1,13 @@
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 %>
@@ -0,0 +1,36 @@
1
+ ## Alternate coverage report formatters
2
+
3
+ The community around simplecov provides a whole bunch of alternate formatters beyond the official
4
+ [simplecov-html](https://github.com/colszowka/simplecov-html) gem.
5
+
6
+ If you have built or found one that is missing here, please send a Pull Request for this document!
7
+
8
+ #### [simplecov-badge](https://github.com/matthew342/simplecov-badge)
9
+ *by Matt Hale*
10
+
11
+ A formatter that generates a coverage badge for use in your project's readme using ImageMagick.
12
+
13
+ #### [simplecov-cobertura](https://github.com/dashingrocket/simplecov-cobertura)
14
+ *by Jesse Bowes*
15
+
16
+ A formatter that generates Cobertura XML.
17
+
18
+ #### [simplecov-csv](https://github.com/fguillen/simplecov-csv)
19
+ *by Fernando Guillen*
20
+
21
+ CSV formatter for SimpleCov
22
+
23
+ #### [simplecov-json](https://github.com/vicentllongo/simplecov-json)
24
+ *by Vicent Llongo*
25
+
26
+ JSON formatter for SimpleCov
27
+
28
+ #### [simplecov-rcov](https://github.com/fguillen/simplecov-rcov)
29
+ *by Fernando Guillen*
30
+
31
+ "The target of this formatter is to cheat on Hudson so I can use the Ruby metrics plugin with SimpleCov."
32
+
33
+ #### [simplecov-single_file_reporter](https://github.com/grosser/simplecov-single_file_reporter)
34
+ *by [Michael Grosser](http://grosser.it)*
35
+
36
+ A formatter that prints the coverage of the file under test when you run a single test file.
@@ -0,0 +1,20 @@
1
+ ## Commercial Services with SimpleCov integration
2
+
3
+ There is a bunch of services that offer integration with your existing CI pipeline and SimpleCov coverage
4
+ reports. Please note these are not associated with the SimpleCov project itself, so please report problems with
5
+ these integrations with their respective owners.
6
+
7
+ #### [codeclimate](https://github.com/codeclimate/ruby-test-reporter)
8
+ *by [Code Climate](https://codeclimate.com/)*
9
+
10
+ Upload coverage reports to [codeclimate.com](https://codeclimate.com/), a hosted software quality analysis and that also includes coverage reporting.
11
+
12
+ #### [codecov](https://github.com/codecov/codecov-ruby)
13
+ *by [Codecov](https://codecov.io/)*
14
+
15
+ Upload coverage reports to [codecov.io](https://codecov.io/), a hosted coverage reporting solution.
16
+
17
+ #### [coveralls](https://github.com/lemurheavy/coveralls-ruby)
18
+ *by [Coveralls](https://coveralls.io/)*
19
+
20
+ Upload coverage reports to [coveralls.io](https://coveralls.io/), a hosted coverage reporting solution.
@@ -0,0 +1,13 @@
1
+ ## Editor integration
2
+
3
+ Some editors have a graphical integration for the simplecov gem.
4
+
5
+ #### [Atom Editor: coverage](https://atom.io/packages/coverage)
6
+ *by Philip Giuliani*
7
+
8
+ Adds an overview of your current test coverage to Atom.
9
+
10
+ #### [cadre](https://github.com/nyarly/cadre)
11
+ *by Judson Lester*
12
+
13
+ Includes a formatter for Simplecov that emits a Vim script to mark up code files with coverage information.
@@ -0,0 +1,46 @@
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 % |
@@ -0,0 +1,45 @@
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 |
@@ -0,0 +1,33 @@
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
@@ -0,0 +1,42 @@
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
+
@@ -0,0 +1,77 @@
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/
@@ -0,0 +1,39 @@
1
+ @test_unit @rspec @merging @config
2
+ Feature:
3
+
4
+ The maximum time between resultset merges can be customized
5
+ using SimpleCov.merge_timeout SECONDS. This can be helpful for
6
+ long-running test-suites that fail to merge because of the time
7
+ between individual suite finishes is more then the default timeout
8
+ of 10 minutes.
9
+
10
+ Here, for the sake of testing the opposite case is shown, choosing
11
+ a merge timeout so short that the first test suite's results actually
12
+ are out of date when the second suite finishes and thus does not end up
13
+ in the report.
14
+
15
+ Scenario:
16
+ Given SimpleCov for Test/Unit is configured with:
17
+ """
18
+ require 'simplecov'
19
+ SimpleCov.start do
20
+ merge_timeout 5
21
+ end
22
+ """
23
+ Given SimpleCov for RSpec is configured with:
24
+ """
25
+ require 'simplecov'
26
+ SimpleCov.start do
27
+ merge_timeout 5
28
+ end
29
+ """
30
+
31
+ When I open the coverage report generated with `bundle exec rake test`
32
+ Then the report should be based upon:
33
+ | Unit Tests |
34
+
35
+ When I wait for 5 seconds
36
+ And I open the coverage report generated with `bundle exec rspec spec`
37
+ Then the report should be based upon:
38
+ | RSpec |
39
+
@@ -0,0 +1,79 @@
1
+ @test_unit @nocov
2
+ Feature:
3
+
4
+ Code wrapped in # :nocov: will be ignored by coverage reports.
5
+ The name of the token can be configured with SimpleCov.nocov_token or SimpleCov.skip_token
6
+
7
+ Scenario: Custom nocov token using nocov_token
8
+ Given SimpleCov for Test/Unit is configured with:
9
+ """
10
+ require 'simplecov'
11
+ SimpleCov.start 'test_frameworks' do
12
+ nocov_token 'skippit'
13
+ end
14
+ """
15
+
16
+ Given a file named "lib/faked_project/nocov.rb" with:
17
+ """
18
+ class SourceCodeWithNocov
19
+ # :skippit:
20
+ def some_weird_code
21
+ never_reached
22
+ rescue => err
23
+ but no one cares about invalid ruby here
24
+ end
25
+ # :skippit:
26
+ end
27
+ """
28
+
29
+ When I open the coverage report generated with `bundle exec rake test`
30
+
31
+ Then I should see the source files:
32
+ | name | coverage |
33
+ | lib/faked_project.rb | 100.0 % |
34
+ | lib/faked_project/some_class.rb | 80.0 % |
35
+ | lib/faked_project/framework_specific.rb | 75.0 % |
36
+ | lib/faked_project/meta_magic.rb | 100.0 % |
37
+ | lib/faked_project/nocov.rb | 100.0 % |
38
+
39
+ And there should be 7 skipped lines in the source files
40
+
41
+ And the report should be based upon:
42
+ | Unit Tests |
43
+
44
+ Scenario: Custom nocov token using skip_token
45
+ Given SimpleCov for Test/Unit is configured with:
46
+ """
47
+ require 'simplecov'
48
+ SimpleCov.start 'test_frameworks' do
49
+ skip_token 'skippit'
50
+ end
51
+ """
52
+
53
+ Given a file named "lib/faked_project/nocov.rb" with:
54
+ """
55
+ class SourceCodeWithNocov
56
+ # :skippit:
57
+ def some_weird_code
58
+ never_reached
59
+ rescue => err
60
+ but no one cares about invalid ruby here
61
+ end
62
+ # :skippit:
63
+ end
64
+ """
65
+
66
+ When I open the coverage report generated with `bundle exec rake test`
67
+
68
+ Then I should see the source files:
69
+ | name | coverage |
70
+ | lib/faked_project.rb | 100.0 % |
71
+ | lib/faked_project/some_class.rb | 80.0 % |
72
+ | lib/faked_project/framework_specific.rb | 75.0 % |
73
+ | lib/faked_project/meta_magic.rb | 100.0 % |
74
+ | lib/faked_project/nocov.rb | 100.0 % |
75
+
76
+ And there should be 7 skipped lines in the source files
77
+
78
+ And the report should be based upon:
79
+ | Unit Tests |