covered 0.16.1 → 0.16.2

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: b81262b921d5bf71ca05d985d28c806967de336642687e6541507ac55f9eb5ce
4
- data.tar.gz: 4afab1fb523ee9403e6a70c9fc84cb301152f32a8c273367fac79c994cd5e7b8
3
+ metadata.gz: 80e616e80e33e55aa999b041dd1fa8c8bc4c6681bf3ed9634d058eb844693332
4
+ data.tar.gz: ee659443a9957432bb3a9f27d81cd302fb80780205282a9cf45796de57885b61
5
5
  SHA512:
6
- metadata.gz: a59901d7eaca8f7494879453b9df6e024ebe97fa039d5be732edc51c8f9acd258db76a2bc35f4b4a500d69bab68a184da3b70c63a375c5f2f7670c8aeb0e8f15
7
- data.tar.gz: 2092189dd748a544104b63597018b31913b1ec4bbea477a2907cdd01fb8dfcd5dbe842b5d341d58601e9fba62e5a2e2e2077fec572a5375dc98343ca8b6758d6
6
+ metadata.gz: 5e7b2019674c223768d2cce4f7a24f5c654dcfaccf44a0ffc8909ab159eea9aa653db7367274f96aae02e41edd3e1d6fbeff66d3f022e7a177a04a11dfd66412
7
+ data.tar.gz: 11f142830471687a135d541b345fc423b385c940204c49db2d94f99a4cf575511cfa6738bc6db2f9bab23797d598a12145fe21d371b4f1b9a395382ec69087d9
checksums.yaml.gz.sig CHANGED
Binary file
@@ -2,23 +2,25 @@
2
2
  def initialize(context)
3
3
  super
4
4
 
5
- require_relative '../../lib/covered/policy/default'
5
+ require_relative '../../lib/covered/config'
6
6
  end
7
7
 
8
8
  # Validate the coverage of multiple test runs.
9
9
  # @parameter paths [Array(String)] The coverage database paths.
10
10
  # @parameter minumum [Float] The minimum required coverage in order to pass.
11
11
  def validate(paths: nil, minimum: 1.0)
12
+ config = Covered::Config.load
13
+
12
14
  paths&.each do |path|
13
15
  # It would be nice to have a better algorithm here than just ignoring mtime - perhaps using checksums?
14
- Covered::Persist.new($covered.output, path).load!(ignore_mtime: true)
16
+ Covered::Persist.new(config.output, path).load!(ignore_mtime: true)
15
17
  end
16
18
 
17
- $covered.flush
19
+ config.flush
18
20
 
19
21
  statistics = Covered::Statistics.new
20
22
 
21
- $covered.each do |coverage|
23
+ config.each do |coverage|
22
24
  statistics << coverage
23
25
  end
24
26
 
@@ -34,9 +34,11 @@ module Covered
34
34
  end
35
35
  end
36
36
 
37
- def self.load(root: Dir.pwd, coverage: ENV['COVERAGE'])
38
- return nil unless coverage
39
-
37
+ def self.coverage
38
+ ENV['COVERAGE']
39
+ end
40
+
41
+ def self.load(root: Dir.pwd, coverage: self.coverage)
40
42
  derived = Class.new(self)
41
43
 
42
44
  if path = self.path(root)
@@ -54,10 +56,20 @@ module Covered
54
56
  @policy = nil
55
57
  end
56
58
 
59
+ def record?
60
+ !!@coverage
61
+ end
62
+
63
+ attr :coverage
64
+
57
65
  def policy
58
66
  @policy ||= Policy.new.tap{|policy| make_policy(policy)}.freeze
59
67
  end
60
68
 
69
+ def output
70
+ policy.output
71
+ end
72
+
61
73
  def enable
62
74
  policy.enable
63
75
  end
@@ -74,6 +86,10 @@ module Covered
74
86
  policy.call(output)
75
87
  end
76
88
 
89
+ def each(&block)
90
+ policy.each(&block)
91
+ end
92
+
77
93
  # Override this method to implement your own policy.
78
94
  def make_policy(policy)
79
95
  policy.cache!
@@ -34,7 +34,7 @@ module Covered
34
34
  end
35
35
  end
36
36
 
37
- if $covered
37
+ if $covered.record?
38
38
  class << Minitest
39
39
  prepend Covered::Minitest
40
40
  end
@@ -123,7 +123,7 @@ module Covered
123
123
  end
124
124
 
125
125
  def reports!(coverage)
126
- if coverage
126
+ if coverage.is_a?(String)
127
127
  names = coverage.split(',')
128
128
 
129
129
  names.each do |name|
@@ -134,7 +134,7 @@ module Covered
134
134
  @reports << Autoload.new(name)
135
135
  end
136
136
  end
137
- else
137
+ elsif coverage
138
138
  @reports << Covered::BriefSummary.new
139
139
  end
140
140
  end
data/lib/covered/rspec.rb CHANGED
@@ -57,7 +57,7 @@ module Covered
57
57
  end
58
58
  end
59
59
 
60
- if $covered
60
+ if $covered.record?
61
61
  RSpec::Core::Configuration.prepend(Covered::RSpec::Policy)
62
62
 
63
63
  RSpec.configure do |config|
@@ -72,9 +72,10 @@ module Covered
72
72
  send: true,
73
73
  yield: true,
74
74
  return: true,
75
- lvar: true,
76
- ivar: true,
77
- def: true
75
+ def: true,
76
+ if: true,
77
+ lvasgn: true, ivasgn: true, cvasgn: true, gvasgn: true,
78
+ match_pattern: true
78
79
  }
79
80
 
80
81
  def executable?(node)
@@ -19,5 +19,5 @@
19
19
  # THE SOFTWARE.
20
20
 
21
21
  module Covered
22
- VERSION = "0.16.1"
22
+ VERSION = "0.16.2"
23
23
  end
data.tar.gz.sig CHANGED
Binary file
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.16.1
4
+ version: 0.16.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
@@ -39,7 +39,7 @@ cert_chain:
39
39
  RAOsIl+HOBTb252nx1kIRN5hqQx272AJCbCjKx8egcUQKffFVVCI0nye09v5CK+a
40
40
  HiLJ8VOFx6w=
41
41
  -----END CERTIFICATE-----
42
- date: 2022-06-14 00:00:00.000000000 Z
42
+ date: 2022-06-15 00:00:00.000000000 Z
43
43
  dependencies:
44
44
  - !ruby/object:Gem::Dependency
45
45
  name: async-rest
@@ -197,7 +197,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
197
197
  - !ruby/object:Gem::Version
198
198
  version: '0'
199
199
  requirements: []
200
- rubygems_version: 3.3.7
200
+ rubygems_version: 3.1.6
201
201
  signing_key:
202
202
  specification_version: 4
203
203
  summary: A modern approach to code coverage.
metadata.gz.sig CHANGED
Binary file