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 +4 -4
- data/lib/covered/rspec.rb +7 -1
- data/lib/covered/source.rb +3 -4
- data/lib/covered/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2da5bcb0da1de420cf2833d1f2dfbc4ff26cf1eb85e1552d3b5e79902f09ff5c
|
4
|
+
data.tar.gz: 6bcbbd747726ac1ec443b97401058b85fce046abd5a777085288e105d0f2010d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
data/lib/covered/source.rb
CHANGED
@@ -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 "#{
|
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
|
|
data/lib/covered/version.rb
CHANGED