covered 0.8.0 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 427269046d977cdbbf273f6b037306b94b767bac227611c4bb088284ba386a3d
4
- data.tar.gz: 60562f99f72cb13819d75f53ee9d4d24397d3391656e005def4b085ef48b607f
3
+ metadata.gz: 832fa815563de02d41b8036c455e30e77d2af630f3a40b7bedff85c538f60227
4
+ data.tar.gz: 71b0144166e1a7285eb9e9db91ebd9904ec567646eb80a9f7d31dcaa7600c562
5
5
  SHA512:
6
- metadata.gz: 5957818e2d53357da2fd7874d1040a36dd032d1ba287047724684f1702b2d866a66910c3b1254b4ee2788751e0016de6eb26fa17392c6758e524f9a69e3c5125
7
- data.tar.gz: 749be10e7c7a56a8f93b34c347abab188aafde3ee0af70806e2d4e991a7a9c4ed6dd5a1eb05ea1ce46907fe4e5463460a48b3e1006b7a67f4cb40a03781a1a8b
6
+ metadata.gz: aa48464fc936d9b2e30079c0fcd3bb8cd338f958f8e49a45bdfe063de94f2d6819970f36d13958c48d3c93d854274d6723574db8c4eaf88509d3cb0b2cf37db8
7
+ data.tar.gz: 18cb7e0b47dddde9a80bfddc54762082ca55cea95215a14331c7ca8ae45325162063336f2b6ee2bb4106f506f612bc432d3f9275a21d404dca6ac4c94e08f0f9
data/README.md CHANGED
@@ -17,16 +17,15 @@ It's still tricky to do it correctly, but it is feasible now to compute coverage
17
17
  Add this line to your application's `Gemfile`:
18
18
 
19
19
  ```ruby
20
- group :test do
21
- gem 'covered', require: 'covered/rspec'
22
- end
20
+ gem 'covered'
23
21
  ```
24
22
 
23
+ ### RSpec Integration
24
+
25
25
  In your `spec/spec_helper.rb` add the following before loading any other code:
26
26
 
27
27
  ```ruby
28
- require 'bundler/setup'
29
- Bundler.require(:test)
28
+ require 'covered/rspec'
30
29
  ```
31
30
 
32
31
  Ensure that you have a `.rspec` file with `--require spec_helper`:
@@ -37,6 +36,21 @@ Ensure that you have a `.rspec` file with `--require spec_helper`:
37
36
  --warnings
38
37
  ```
39
38
 
39
+ ### Minitest Integration
40
+
41
+ In your `test/test_helper.rb` add the following before loading any other code:
42
+
43
+ ```ruby
44
+ require 'covered/minitest'
45
+ require 'minitest/autorun'
46
+ ```
47
+
48
+ In your test files, e.g. `test/dummy_test.rb` add the following at the top:
49
+
50
+ ```ruby
51
+ require_relative 'test_helper'
52
+ ```
53
+
40
54
  ## Usage
41
55
 
42
56
  When running `rspec`, you can specify the kind of coverage analysis you would like:
data/Rakefile CHANGED
@@ -1,6 +1,13 @@
1
1
  require "bundler/gem_tasks"
2
2
  require "rspec/core/rake_task"
3
3
 
4
+ # For RSpec
4
5
  RSpec::Core::RakeTask.new(:spec)
5
6
 
6
- task :default => :spec
7
+ # For Minitest
8
+ require 'rake/testtask'
9
+ Rake::TestTask.new(:test) do |task|
10
+ task.pattern = "test/*_test.rb"
11
+ end
12
+
13
+ task :default => :spec
data/covered.gemspec CHANGED
@@ -27,4 +27,5 @@ Gem::Specification.new do |spec|
27
27
  spec.add_development_dependency "bundler"
28
28
  spec.add_development_dependency "rake", "~> 10.0"
29
29
  spec.add_development_dependency "rspec", "~> 3.6"
30
+ spec.add_development_dependency "minitest"
30
31
  end
@@ -0,0 +1,45 @@
1
+ # Copyright, 2019, by Samuel G. D. Williams. <http://www.codeotaku.com>
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ # of this software and associated documentation files (the "Software"), to deal
5
+ # in the Software without restriction, including without limitation the rights
6
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ # copies of the Software, and to permit persons to whom the Software is
8
+ # furnished to do so, subject to the following conditions:
9
+ #
10
+ # The above copyright notice and this permission notice shall be included in
11
+ # all copies or substantial portions of the Software.
12
+ #
13
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ # THE SOFTWARE.
20
+
21
+ require_relative 'policy'
22
+ require_relative 'policy/default'
23
+
24
+ require 'minitest'
25
+
26
+ module Covered
27
+ module Minitest
28
+ def run(*)
29
+ $covered.enable
30
+
31
+ super
32
+ end
33
+ end
34
+ end
35
+
36
+ if ENV['COVERAGE']
37
+ class << Minitest
38
+ prepend Covered::Minitest
39
+ end
40
+
41
+ Minitest.after_run do
42
+ $covered.disable
43
+ $covered.print_summary($stderr)
44
+ end
45
+ end
@@ -24,8 +24,8 @@ $covered = Covered.policy do
24
24
  # Only files in the root would be tracked:
25
25
  root Dir.pwd
26
26
 
27
- # We will ignore any files in the spec directory:
28
- skip /spec/
27
+ # We will ignore any files in the test or spec directory:
28
+ skip /test|spec/
29
29
 
30
30
  # We will include all files under lib, even if they aren't loaded:
31
31
  include "lib/**/*.rb"
@@ -19,5 +19,5 @@
19
19
  # THE SOFTWARE.
20
20
 
21
21
  module Covered
22
- VERSION = "0.8.0"
22
+ VERSION = "0.9.0"
23
23
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: covered
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
@@ -94,6 +94,20 @@ dependencies:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
96
  version: '3.6'
97
+ - !ruby/object:Gem::Dependency
98
+ name: minitest
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
97
111
  description:
98
112
  email:
99
113
  - samuel.williams@oriontransfer.co.nz
@@ -114,6 +128,7 @@ files:
114
128
  - lib/covered/coverage.rb
115
129
  - lib/covered/eval.rb
116
130
  - lib/covered/files.rb
131
+ - lib/covered/minitest.rb
117
132
  - lib/covered/policy.rb
118
133
  - lib/covered/policy/default.rb
119
134
  - lib/covered/rspec.rb