simplecov 0.6.2 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/.gitignore CHANGED
@@ -1,5 +1,6 @@
1
1
  .bundle
2
2
  Gemfile.lock
3
+ gemfiles/*.lock
3
4
 
4
5
  ## MAC OS
5
6
  .DS_Store
@@ -23,6 +24,7 @@ rdoc
23
24
  pkg
24
25
  tmp
25
26
  capybara*.html
27
+ .rvmrc
26
28
 
27
29
  ## PROJECT::SPECIFIC
28
30
 
data/.travis.yml CHANGED
@@ -1,12 +1,20 @@
1
- script: "bundle exec rake test && bundle exec cucumber features"
1
+ before_install:
2
+ - echo "yes" | gem uninstall json
3
+ script:
4
+ - bundle
5
+ - rake appraisal:install
6
+ - rake appraisal
2
7
  rvm:
3
- # - 1.8.6 # Has trouble with rake 0.9+ :(
4
8
  - 1.8.7
5
9
  - 1.9.2
6
10
  - 1.9.3
11
+ - ruby-head
7
12
  - ree
8
- - rbx
9
- - jruby
13
+ - rbx-18mode
14
+ - jruby-18mode
15
+ matrix:
16
+ allow_failures:
17
+ - rvm: ruby-head
10
18
  notifications:
11
19
  email:
12
20
  on_success: always
data/.yardopts ADDED
@@ -0,0 +1 @@
1
+ - **/*.md
data/Appraisals ADDED
@@ -0,0 +1,8 @@
1
+ # See https://github.com/colszowka/simplecov/issues/132
2
+ appraise "multi_json-new" do
3
+ gem "multi_json", ">= 1.3.4"
4
+ end
5
+
6
+ appraise "multi_json-legacy" do
7
+ gem "multi_json", "~> 1.0.0"
8
+ end
data/CHANGELOG.md CHANGED
@@ -1,17 +1,61 @@
1
- v0.6.2 (2012-04-20)
2
- ===================
3
-
4
- * Updated to latest version of MultiJSON and it's new API (thanks to @sferik and @ronen).
1
+ Unreleased ([changes](https://github.com/colszowka/simplecov/compare/v0.7.0...master))
2
+ -------------------
3
+
4
+ v0.7.0, 2012-10-10 ([changes](https://github.com/colszowka/simplecov/compare/v0.6.4...v0.7.0))
5
+ -------------------
6
+
7
+ * [FEATURE] The new `maximum_coverage_drop` and `minimum_coverage` now allow you to fail your build when the
8
+ coverage dropped by more than what you allowed or is below a minimum value required. Also, `refuse_coverage_drop` disallows
9
+ any coverage drops between test runs.
10
+ See https://github.com/colszowka/simplecov/pull/151, https://github.com/colszowka/simplecov/issues/11,
11
+ https://github.com/colszowka/simplecov/issues/90, and https://github.com/colszowka/simplecov/issues/96 (thanks to @infertux)
12
+ * [FEATURE] SimpleCov now ships with a built-in MultiFormatter which allows the easy usage of multiple result formatters at
13
+ the same time without the need to write custom wrapper code.
14
+ See https://github.com/colszowka/simplecov/pull/158 (thanks to @nikitug)
15
+ * [BUGFIX] The usage of digits, hyphens and underscores in group names could lead to broken tab navigation
16
+ in the default simplecov-html reports. See https://github.com/colszowka/simplecov-html/pull/14 (thanks to @ebelgarts)
17
+ * [REFACTORING] A few more ruby warnings removed. See https://github.com/colszowka/simplecov/issues/106 and
18
+ https://github.com/colszowka/simplecov/pull/139. (thanks to @lukejahnke)
19
+ * A [Pledgie button](https://github.com/colszowka/simplecov/commit/63cfa99f8658fa5cc66a38c83b3195fdf71b9e93) for those that
20
+ feel generous :)
21
+ * The usual bunch of README fixes and documentation tweaks. Thanks to everyone who contributed those!
22
+
23
+ v0.6.4, 2012-05-10 ([changes](https://github.com/colszowka/simplecov/compare/v0.6.3...v0.6.4))
24
+ -------------------
25
+
26
+ * [BUGFIX] Encoding issues with ISO-8859-encoded source files fixed.
27
+ See https://github.com/colszowka/simplecov/pull/117. (thanks to @Deradon)
28
+ * [BUGFIX] Ensure ZeroDivisionErrors won't occur when calculating the coverage result, which previously
29
+ could happen in certain cases. See https://github.com/colszowka/simplecov/pull/128. (thanks to @japgolly)
30
+ * [REFACTORING] Changed a couple instance variable lookups so SimpleCov does not cause a lot of warnings when
31
+ running ruby at a higher warning level. See https://github.com/colszowka/simplecov/issues/106 and
32
+ https://github.com/colszowka/simplecov/pull/119. (thanks to @mvz and @gioele)
33
+
34
+
35
+ v0.6.3, 2012-05-10 ([changes](https://github.com/colszowka/simplecov/compare/v0.6.2...v0.6.3))
36
+ -------------------
37
+
38
+ * [BUGFIX] Modified the API-changes for newer multi_json versions introduced with #122 and v0.6.2 so
39
+ they are backwards-compatible with older multi_json gems in order to avoid simplecov polluting
40
+ the multi_json minimum version requirement for entire applications.
41
+ See https://github.com/colszowka/simplecov/issues/132
42
+ * Added appraisal gem to the test setup in order to run the test suite against both 1.0 and 1.3
43
+ multi_json gems and ensure the above actually works :)
44
+
45
+ v0.6.2, 2012-04-20 ([changes](https://github.com/colszowka/simplecov/compare/v0.6.1...v0.6.2))
46
+ -------------------
47
+
48
+ * [Updated to latest version of MultiJSON and its new API (thanks to @sferik and @ronen).
5
49
  See https://github.com/colszowka/simplecov/pull/122
6
50
 
7
- v0.6.1 (2012-02-24)
8
- ===================
51
+ v0.6.1, 2012-02-24 ([changes](https://github.com/colszowka/simplecov/compare/v0.6.0...v0.6.1))
52
+ -------------------
9
53
 
10
54
  * [BUGFIX] Don't force-load Railtie on Rails < 3. Fixes regression introduced with
11
55
  #83. See https://github.com/colszowka/simplecov/issues/113
12
56
 
13
- v0.6.0 (2012-02-22)
14
- ===================
57
+ v0.6.0, 2012-02-22 ([changes](https://github.com/colszowka/simplecov/compare/v0.5.4...v0.6.0))
58
+ -------------------
15
59
 
16
60
  * [FEATURE] Auto-magic `rake simplecov` task for rails
17
61
  (see https://github.com/colszowka/simplecov/pull/83, thanks @sunaku)
@@ -26,8 +70,8 @@ v0.6.0 (2012-02-22)
26
70
  * Some refactorings and cleanups as usual. Please refer to the github compare view for a full
27
71
  list of changes: https://github.com/colszowka/simplecov/compare/v0.5.4...v0.6.0
28
72
 
29
- v0.5.4 (2011-10-12)
30
- ===================
73
+ v0.5.4, 2011-10-12 ([changes](https://github.com/colszowka/simplecov/compare/v0.5.3...v0.5.4))
74
+ -------------------
31
75
 
32
76
  * Do not give exit code 0 when there are exceptions prior to tests
33
77
  (see https://github.com/colszowka/simplecov/issues/41, thanks @nbogie)
@@ -39,8 +83,8 @@ v0.5.4 (2011-10-12)
39
83
  (see https://github.com/colszowka/simplecov/issues/86)
40
84
  * Readme formatted in Markdown :)
41
85
 
42
- v0.5.3 (2011-09-13)
43
- ===================
86
+ v0.5.3, 2011-09-13 ([changes](https://github.com/colszowka/simplecov/compare/v0.5.2...v0.5.3))
87
+ -------------------
44
88
 
45
89
  * Fix for encoding issues that came from the nocov processing mechanism
46
90
  (see https://github.com/colszowka/simplecov/issues/71)
@@ -54,14 +98,14 @@ v0.5.3 (2011-09-13)
54
98
  * Refactored nocov processing and made it configurable using SimpleCov.ncov_token (or it's
55
99
  alias SimpleCov.skip_token)
56
100
 
57
- v0.5.2 (2011-09-12)
58
- ===================
101
+ v0.5.2, 2011-09-12 ([changes](https://github.com/colszowka/simplecov/compare/v0.5.1...v0.5.2))
102
+ -------------------
59
103
 
60
104
  * Another fix for a bug in JSON processing introduced with MultiJSON in 0.5.1
61
105
  (see https://github.com/colszowka/simplecov/pull/75, thanks @sferik)
62
106
 
63
- v0.5.1 (2011-09-12)
64
- ===================
107
+ v0.5.1, 2011-09-12 ([changes](https://github.com/colszowka/simplecov/compare/v0.5.0...v0.5.1))
108
+ -------------------
65
109
  **Note: Yanked 2011-09-12 because the MultiJSON-patch had a crucial bug**
66
110
 
67
111
  * Fix for invalid gemspec dependency string (see https://github.com/colszowka/simplecov/pull/70,
@@ -71,8 +115,8 @@ v0.5.1 (2011-09-12)
71
115
  is unavailable (see https://github.com/colszowka/simplecov/issues/72
72
116
  and https://github.com/colszowka/simplecov/pull/74, thanks @sferik)
73
117
 
74
- v0.5.0 (2011-09-09)
75
- ===================
118
+ v0.5.0, 2011-09-09 ([changes](https://github.com/colszowka/simplecov/compare/v0.4.2...v0.5.4))
119
+ -------------------
76
120
  **Note: Yanked 2011-09-09 because of trouble with the gemspec.**
77
121
 
78
122
  * JSON is now used instead of YAML for resultset caching (used for merging). Should resolve
@@ -111,10 +155,9 @@ v0.5.0 (2011-09-09)
111
155
 
112
156
  * Full compatibility with Ruby 1.9.3.preview1
113
157
 
114
- HTML Formatter:
115
- ---------------
158
+ ### HTML Formatter:
116
159
 
117
160
  * The display of source files has been improved a lot. Weird scrolling trouble, out-of-scope line hit counts
118
161
  and such should be a thing of the past. Also, it is prettier now.
119
162
  * Source files are now syntax highlighted
120
- * File paths no longer have that annoying './' in front of them
163
+ * File paths no longer have that annoying './' in front of them
data/CONTRIBUTING.md ADDED
@@ -0,0 +1,20 @@
1
+ # Making Contributions
2
+
3
+ To fetch & test the library for development, do:
4
+
5
+ $ git clone https://github.com/colszowka/simplecov.git
6
+ $ cd simplecov
7
+ $ bundle
8
+ $ rake appraisal:install
9
+ $ rake appraisal
10
+
11
+ For more information on the appraisal gem (for testing against multiple gem dependency versions), please see
12
+ https://github.com/thoughtbot/appraisal/
13
+
14
+ If you want to contribute, please:
15
+
16
+ * Fork the project.
17
+ * Make your feature addition or bug fix.
18
+ * Add tests for it. This is important so I don't break it in a future version unintentionally.
19
+ * **Bonus Points** go out to anyone who also updates `CHANGELOG.md` :)
20
+ * Send me a pull request on Github.
data/Gemfile CHANGED
@@ -1,9 +1,5 @@
1
1
  source "http://rubygems.org"
2
2
  gemspec
3
3
 
4
- # Use local copy of simplecov-html in development when checked out
5
- if File.directory?(File.dirname(__FILE__) + '/../simplecov-html')
6
- gem 'simplecov-html', :path => File.dirname(__FILE__) + '/../simplecov-html'
7
- else
8
- gem 'simplecov-html', :git => 'https://github.com/colszowka/simplecov-html'
9
- end
4
+ # Uncomment this to use local copy of simplecov-html in development when checked out
5
+ # gem 'simplecov-html', :path => File.dirname(__FILE__) + '/../simplecov-html'
data/README.md CHANGED
@@ -1,15 +1,14 @@
1
1
  SimpleCov [![Build Status](https://secure.travis-ci.org/colszowka/simplecov.png)][Continuous Integration] [![Dependency Status](https://gemnasium.com/colszowka/simplecov.png)][Dependencies]
2
2
  =========
3
- *Code coverage for Ruby 1.9*
3
+ **Code coverage for Ruby 1.9**
4
4
 
5
5
  * [Source Code]
6
6
  * [API documentation]
7
7
  * [Changelog]
8
8
  * [Rubygem]
9
9
  * [Continuous Integration]
10
- * IRC #simplecov on Freenode
11
10
 
12
- [Coverage]: http://www.ruby-doc.org/ruby-1.9/classes/Coverage.html "API doc for Ruby 1.9's Coverage library"
11
+ [Coverage]: http://www.ruby-doc.org/stdlib-1.9.3/libdoc/coverage/rdoc/Coverage.html "API doc for Ruby 1.9's Coverage library"
13
12
  [Source Code]: https://github.com/colszowka/simplecov "Source Code @ GitHub"
14
13
  [API documentation]: http://rubydoc.info/gems/simplecov/frames "RDoc API Documentation at Rubydoc.info"
15
14
  [Configuration]: http://rubydoc.info/gems/simplecov/SimpleCov/Configuration "Configuration options API documentation"
@@ -18,7 +17,9 @@ SimpleCov [![Build Status](https://secure.travis-ci.org/colszowka/simplecov.png)
18
17
  [Continuous Integration]: http://travis-ci.org/colszowka/simplecov "SimpleCov is built around the clock by travis-ci.org"
19
18
  [Dependencies]: https://gemnasium.com/colszowka/simplecov "SimpleCov dependencies on Gemnasium"
20
19
  [simplecov-html]: https://github.com/colszowka/simplecov-html "SimpleCov HTML Formatter Source Code @ GitHub"
20
+ [Pledgie]: http://www.pledgie.com/campaigns/18379
21
21
 
22
+ [![You can support the development of SimpleCov via Pledgie - thanks for your help](http://www.pledgie.com/campaigns/18379.png?skin_name=chrome)][Pledgie]
22
23
 
23
24
  SimpleCov is a code coverage analysis tool for Ruby 1.9. It uses [1.9's built-in Coverage][Coverage] library to gather code
24
25
  coverage data, but makes processing its results much easier by providing a clean API to filter, group, merge, format
@@ -49,8 +50,20 @@ Getting started
49
50
 
50
51
  # Previous content of test helper now starts here
51
52
 
52
- **Note:** If SimpleCov starts after your application code is already loaded (via `require`), it won't be able to track your files and their coverage!
53
- The `SimpleCov.start` **must** be issued **before any of your application code is required!**
53
+ **Note:** If SimpleCov starts after your application code is already loaded (via `require`), it won't be able to
54
+ track your files and their coverage! The `SimpleCov.start` **must** be issued **before any of your application code
55
+ is required!**
56
+
57
+ SimpleCov must be running in the process that you want the code coverage analysis to happen on. When testing a server
58
+ process (i.e. a JSON API endpoint) via a separate test process (i.e. when using Selenium) where you want to see all
59
+ code executed by the `rails server`, and not just code executed in your actual test files, you'll want to add something
60
+ like this to the top of `script/rails`:
61
+
62
+ if ENV['RAILS_ENV'] == 'test'
63
+ require 'simplecov'
64
+ SimpleCov.start 'rails'
65
+ puts "required simplecov"
66
+ end
54
67
 
55
68
  3. Run your tests, open up `coverage/index.html` in your browser and check out what you've missed so far.
56
69
 
@@ -94,7 +107,7 @@ care what kind of framework it is running in, it just looks at what code is bein
94
107
 
95
108
  ### Notes on specific frameworks and test utilities
96
109
 
97
- For some frameworks and testing tools there are quirks and problems you might want to know about if you want
110
+ For some frameworks and testing tools there are quirks and problems you might want to know about if you want
98
111
  to use SimpleCov with them. Here's an overview of the known ones:
99
112
 
100
113
  <table>
@@ -108,7 +121,7 @@ to use SimpleCov with them. Here's an overview of the known ones:
108
121
  <code>test-unit</code> releases 2.4.3+ (Dec 11th, 2011) should have this problem resolved.
109
122
  </td>
110
123
  <td>
111
- <a href="https://github.com/colszowka/simplecov/issues/45">SimpleCov #45</a> &
124
+ <a href="https://github.com/colszowka/simplecov/issues/45">SimpleCov #45</a> &
112
125
  <a href="https://github.com/test-unit/test-unit/pull/12">Test/Unit #12</a>
113
126
  </td>
114
127
  </tr>
@@ -149,6 +162,18 @@ to use SimpleCov with them. Here's an overview of the known ones:
149
162
  <a href="https://github.com/colszowka/simplecov/issues/80">SimpleCov #80</a>
150
163
  </td>
151
164
  </tr>
165
+ <tr>
166
+ <td>
167
+ <b>RubyMine</b>
168
+ </td>
169
+ <td>
170
+ The <a href="https://www.jetbrains.com/ruby/">RubyMine IDE</a> has built-in support for SimpleCov's coverage reports,
171
+ though you might need to explicitly set the output root using `SimpleCov.root('foo/bar/baz')`
172
+ </td>
173
+ <td>
174
+ <a href="https://github.com/colszowka/simplecov/issues/95">SimpleCov #95</a>
175
+ </td>
176
+ </tr>
152
177
  </table>
153
178
 
154
179
  ## Configuring SimpleCov
@@ -265,7 +290,7 @@ Add your groups with:
265
290
 
266
291
  Normally, you want to have your coverage analyzed across ALL of your test suites, right?
267
292
 
268
- Simplecov automatically caches coverage results in your (coverage_path)/resultset.yml. Those results will then
293
+ Simplecov automatically caches coverage results in your (coverage_path)/.resultset.json. Those results will then
269
294
  be automatically merged when generating the result, so when coverage is set up properly for cucumber and your
270
295
  unit / functional / integration tests, all of those test suites will be taken into account when building the
271
296
  coverage report.
@@ -392,6 +417,23 @@ You can define what simplecov should do when your test suite finishes by customi
392
417
 
393
418
  Above is the default behaviour. Do whatever you like instead!
394
419
 
420
+ ### Minimum coverage
421
+
422
+ You can define the minimum coverage percentage expected. SimpleCov will return non-zero if unmet.
423
+
424
+ SimpleCov.minimum_coverage 90
425
+
426
+ ### Maximum coverage drop
427
+
428
+ You can define the maximum coverage drop percentage at once. SimpleCov will return non-zero if exceeded.
429
+
430
+ SimpleCov.maximum_coverage_drop 5
431
+
432
+ ### Refuse dropping coverage
433
+
434
+ You can also entirely refuse dropping coverage between test runs:
435
+
436
+ SimpleCov.refuse_coverage_drop
395
437
 
396
438
  ## Using your own formatter
397
439
 
@@ -405,18 +447,12 @@ being an instance of SimpleCov::Result. Do whatever your wish with that!
405
447
 
406
448
  ## Using multiple formatters
407
449
 
408
- There is currently no built-in support for this, but you could help yourself with a wrapper class:
409
-
410
- class SimpleCov::Formatter::MergedFormatter
411
- def format(result)
412
- SimpleCov::Formatter::HTMLFormatter.new.format(result)
413
- SimpleCov::Formatter::CSVFormatter.new.format(result)
414
- end
415
- end
416
-
417
- Then configure the formatter to use the new merger:
450
+ If you want to use multiple result formats, as of SimpleCov 0.7.0 you can use the built-in MultiFormatter:
418
451
 
419
- SimpleCov.formatter = SimpleCov::Formatter::MergedFormatter
452
+ SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
453
+ SimpleCov::Formatter::HTMLFormatter,
454
+ SimpleCov::Formatter::CSVFormatter,
455
+ ]
420
456
 
421
457
  ## Available formatters
422
458
 
@@ -433,7 +469,10 @@ available:
433
469
 
434
470
  CSV formatter for SimpleCov code coverage tool for ruby 1.9+
435
471
 
472
+ #### [simplecov-vim](https://github.com/nyarly/Simplecov-Vim)
473
+ *by Judson Lester*
436
474
 
475
+ A formatter for Simplecov that emits a Vim script to mark up code files with coverage information.
437
476
 
438
477
  ## Ruby version compatibility
439
478
 
@@ -446,29 +485,13 @@ interpreters add the coverage library.
446
485
 
447
486
  SimpleCov is built in [Continuous Integration] on 1.8.7, ree, 1.9.2, 1.9.3.
448
487
 
488
+ ## Contributing
449
489
 
450
-
451
- ## Contributions
452
-
453
- To fetch & test the library for development, do:
454
-
455
- $ git clone https://github.com/colszowka/simplecov
456
- $ cd simplecov
457
- $ bundle
458
- $ bundle exec rake test && bundle exec cucumber features
459
-
460
- If you wont to contribute, please:
461
-
462
- * Fork the project.
463
- * Make your feature addition or bug fix.
464
- * Add tests for it. This is important so I don't break it in a future version unintentionally.
465
- * Send me a pull request on Github.
490
+ See the [contributing guide](https://github.com/colszowka/simplecov/blob/master/CONTRIBUTING.md).
466
491
 
467
492
  ## Kudos
468
493
 
469
- Thanks to Aaron Patterson (http://engineering.attinteractive.com/2010/08/code-coverage-in-ruby-1-9/) for the original idea
470
- for this!
471
-
494
+ Thanks to Aaron Patterson for the original idea for this!
472
495
 
473
496
  ## Copyright
474
497
 
data/Rakefile CHANGED
@@ -1,6 +1,8 @@
1
1
  #!/usr/bin/env rake
2
2
 
3
- require 'bundler'
3
+ require 'rubygems'
4
+ require 'bundler/setup'
5
+ require 'appraisal'
4
6
  Bundler::GemHelper.install_tasks
5
7
 
6
8
  require 'rake/testtask'
@@ -8,6 +10,7 @@ Rake::TestTask.new(:test) do |test|
8
10
  test.libs << 'lib' << 'test'
9
11
  test.test_files = FileList['test/test_*.rb']
10
12
  test.verbose = true
13
+ test.warning = true
11
14
  end
12
15
 
13
16
  require 'cucumber/rake/task'
@@ -0,0 +1,52 @@
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.formatter = SimpleCov::Formatter::MultiFormatter[
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/
@@ -32,7 +32,8 @@ Feature:
32
32
  Then the report should be based upon:
33
33
  | Unit Tests |
34
34
 
35
- When I open the coverage report generated with `bundle exec rspec spec`
35
+ When I wait for 2 seconds
36
+ And I open the coverage report generated with `bundle exec rspec spec`
36
37
  Then the report should be based upon:
37
38
  | RSpec |
38
39
 
@@ -0,0 +1,36 @@
1
+ @test_unit @config
2
+ Feature:
3
+
4
+ Exit code should be non-zero if the overall coverage decreases by more than
5
+ the maximum_coverage_drop threshold.
6
+
7
+ Scenario:
8
+ Given SimpleCov for Test/Unit is configured with:
9
+ """
10
+ require 'simplecov'
11
+ SimpleCov.start do
12
+ add_filter 'test.rb'
13
+ maximum_coverage_drop 3.14
14
+ end
15
+ """
16
+
17
+ When I run `bundle exec rake test`
18
+ Then the exit status should be 0
19
+ And a file named "coverage/.last_run.json" should exist
20
+
21
+ Given a file named "lib/faked_project/missed.rb" with:
22
+ """
23
+ class UncoveredSourceCode
24
+ def foo
25
+ never_reached
26
+ rescue => err
27
+ but no one cares about invalid ruby here
28
+ end
29
+ end
30
+ """
31
+
32
+ When I run `bundle exec rake test`
33
+ Then the exit status should not be 0
34
+ And the output should contain "Coverage has dropped by 3.32% since the last time (maximum allowed: 3.14%)."
35
+ And a file named "coverage/.last_run.json" should exist
36
+
@@ -34,7 +34,7 @@ Feature:
34
34
 
35
35
  And I should see the groups:
36
36
  | name | coverage | files |
37
- | All Files | 90.48% | 4 |
37
+ | All Files | 90.48% | 4 |
38
38
 
39
39
  And I should see the source files:
40
40
  | name | coverage |
@@ -0,0 +1,59 @@
1
+ @test_unit @config
2
+ Feature:
3
+
4
+ Exit code should be non-zero if the overall coverage is below the
5
+ minimum_coverage threshold.
6
+
7
+ Scenario:
8
+ Given SimpleCov for Test/Unit is configured with:
9
+ """
10
+ require 'simplecov'
11
+ SimpleCov.start do
12
+ add_filter 'test.rb'
13
+ minimum_coverage 90
14
+ end
15
+ """
16
+
17
+ When I run `bundle exec rake test`
18
+ Then the exit status should not be 0
19
+ And the output should contain "Coverage (88.10%) is below the expected minimum coverage (90.00%)."
20
+
21
+ Scenario:
22
+ Given SimpleCov for Test/Unit is configured with:
23
+ """
24
+ require 'simplecov'
25
+ SimpleCov.start do
26
+ add_filter 'test.rb'
27
+ minimum_coverage 88.11
28
+ end
29
+ """
30
+
31
+ When I run `bundle exec rake test`
32
+ Then the exit status should not be 0
33
+ And the output should contain "Coverage (88.10%) is below the expected minimum coverage (88.11%)."
34
+
35
+ Scenario:
36
+ Given SimpleCov for Test/Unit is configured with:
37
+ """
38
+ require 'simplecov'
39
+ SimpleCov.start do
40
+ add_filter 'test.rb'
41
+ minimum_coverage 88.10
42
+ end
43
+ """
44
+
45
+ When I run `bundle exec rake test`
46
+ Then the exit status should be 0
47
+
48
+ Scenario:
49
+ Given SimpleCov for Test/Unit is configured with:
50
+ """
51
+ require 'simplecov'
52
+ SimpleCov.start do
53
+ add_filter 'test.rb'
54
+ end
55
+ """
56
+
57
+ When I run `bundle exec rake test`
58
+ Then the exit status should be 0
59
+
@@ -0,0 +1,35 @@
1
+ @test_unit @config
2
+ Feature:
3
+
4
+ Exit code should be non-zero if the overall coverage decreases.
5
+
6
+ Scenario:
7
+ Given SimpleCov for Test/Unit is configured with:
8
+ """
9
+ require 'simplecov'
10
+ SimpleCov.start do
11
+ add_filter 'test.rb'
12
+ refuse_coverage_drop
13
+ end
14
+ """
15
+
16
+ When I run `bundle exec rake test`
17
+ Then the exit status should be 0
18
+ And a file named "coverage/.last_run.json" should exist
19
+
20
+ Given a file named "lib/faked_project/missed.rb" with:
21
+ """
22
+ class UncoveredSourceCode
23
+ def foo
24
+ never_reached
25
+ rescue => err
26
+ but no one cares about invalid ruby here
27
+ end
28
+ end
29
+ """
30
+
31
+ When I run `bundle exec rake test`
32
+ Then the exit status should not be 0
33
+ And the output should contain "Coverage has dropped by 3.32% since the last time (maximum allowed: 0.00%)."
34
+ And a file named "coverage/.last_run.json" should exist
35
+
@@ -59,3 +59,8 @@ Then /^the report should be based upon:$/ do |table|
59
59
  }
60
60
  end
61
61
 
62
+ # This is neccessary to ensure timing-dependant tests like the merge timeout
63
+ # do not fail on powerful machines.
64
+ When /^I wait for (\d+) seconds$/ do |seconds|
65
+ sleep seconds.to_i
66
+ end
@@ -0,0 +1,7 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "http://rubygems.org"
4
+
5
+ gem "multi_json", "~> 1.0.0"
6
+
7
+ gemspec :path=>"../"
@@ -0,0 +1,7 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "http://rubygems.org"
4
+
5
+ gem "multi_json", ">= 1.3.4"
6
+
7
+ gemspec :path=>"../"