covered 0.5.1 → 0.5.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: 8ab7cb43335f9a1a56aefb96ceeca0258c84462ddf5657eeaed13e8662eb74e3
4
- data.tar.gz: 68de7fc8c253d5237769e4b0a41383de404c37d6923a73d508401ace75c3f64a
3
+ metadata.gz: 2da5bcb0da1de420cf2833d1f2dfbc4ff26cf1eb85e1552d3b5e79902f09ff5c
4
+ data.tar.gz: 6bcbbd747726ac1ec443b97401058b85fce046abd5a777085288e105d0f2010d
5
5
  SHA512:
6
- metadata.gz: 611f47e4457cbcf2e2b8ed0e3d29c9ef66168c4358c1fd2466278ed0663a222dcef15af62a8a28a0e36d802cdfccafc20ece100a78e6a7a2247e7f45105727f9
7
- data.tar.gz: c1707dbc6141f38bc2782276237de511eb1750e7d5591382c15a8dad7a2cb381c1a45d4150f505f95d1abbb1c1bd113e9ebb805f817d4ebd1d219d99d30cbd53
6
+ metadata.gz: e733ded2af93f6c93cd77a09e43a9cdaf297880c518c834596382be8c4283a417f0720b2e942b85e4260470165c75f14b021637e0c9f8421c3e5816f4ab44463
7
+ data.tar.gz: 247193bd7021f51519cf39ee6d61e801bfd0bf9677dcf65b6c1f6e925c38dd62b17606a1d5546a19d6a2d09d56be69c942641161a58785adc820342c57e8b1e5
data/lib/covered/rspec.rb CHANGED
@@ -22,8 +22,13 @@ require_relative '../covered'
22
22
  require 'rspec/core/formatters'
23
23
 
24
24
  $covered = Covered.policy do
25
+ # Only files in the root would be tracked:
25
26
  root Dir.pwd
26
27
 
28
+ # We will ignore any files in the spec directory:
29
+ skip /spec/
30
+
31
+ # We will include all files under lib, even if they aren't loaded:
27
32
  include "lib/**/*.rb"
28
33
 
29
34
  source
@@ -49,10 +54,11 @@ RSpec.configure do |config|
49
54
  config.add_formatter(Covered::RSpec::Formatter)
50
55
 
51
56
  config.before(:suite) do
52
- $covered.enable
53
57
  end
54
58
 
55
59
  config.after(:suite) do
56
60
  $covered.disable
57
61
  end
58
62
  end
63
+
64
+ $covered.enable
@@ -62,7 +62,6 @@ module Covered
62
62
  def intercept_eval(string, binding = nil, filename = nil, lineno = 1)
63
63
  return unless filename
64
64
 
65
- # TODO replace with Concurrent::Map
66
65
  @mutex.synchronize do
67
66
  @paths[filename] = string
68
67
  end
@@ -77,18 +76,18 @@ module Covered
77
76
  node.nil? or node.type.to_s =~ @ignore
78
77
  end
79
78
 
80
- def expand(node, counts)
79
+ def expand(node, counts, level = 0)
81
80
  # puts "#{node.first_lineno}: #{node.inspect}"
82
81
 
83
82
  counts[node.first_lineno] ||= 0 if executable?(node)
84
83
 
85
- # puts "#{node.inspect} #{node.to_s} -> #{node.children.inspect}"
84
+ # puts "#{"\t"*level}#{node.type} (#{node.first_lineno})"
86
85
  node.children.each do |child|
87
86
  next unless child.is_a? RubyVM::AbstractSyntaxTree::Node
88
87
 
89
88
  next if ignore?(child)
90
89
 
91
- expand(child, counts)
90
+ expand(child, counts, level + 1)
92
91
  end
93
92
  end
94
93
 
@@ -19,5 +19,5 @@
19
19
  # THE SOFTWARE.
20
20
 
21
21
  module Covered
22
- VERSION = "0.5.1"
22
+ VERSION = "0.5.2"
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.5.1
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams