test-prof 0.4.7 → 0.4.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +12 -1
- data/lib/minitest/base_reporter.rb +2 -0
- data/lib/test_prof.rb +1 -1
- data/lib/test_prof/factory_doctor.rb +9 -4
- data/lib/test_prof/factory_doctor/minitest.rb +15 -4
- data/lib/test_prof/version.rb +1 -1
- metadata +2 -3
- data/lib/minitest/fd_ignorable.rb +0 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7ee0adbe47a16f3597f414b935d5917664d66da2
|
4
|
+
data.tar.gz: 132cb58a1c11f996f305bd8e6d0a56318f5fe620
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f39de8ba35ef1ef80c3ece126fae024761829a524d7c3412b08568b71b70a51a24834dc54f135642800de59d31b54629c8876fbaa58f171ca2857b0a48dd82df
|
7
|
+
data.tar.gz: 20b100dd5c25949fb55e7cad47cfec779288f31a553b12b4e42888208ca34d9ff6cff92d91ef26fa9cf862b9315b2fd1becb76e6b9a01ecc904c0a9a057c1608
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,17 @@
|
|
1
1
|
# Change log
|
2
2
|
|
3
|
-
##
|
3
|
+
## 0.4.8
|
4
|
+
|
5
|
+
- Add `minitest` 5.11 support. ([@palkan][])
|
6
|
+
|
7
|
+
- Fix `spring` detection. ([@palkan][])
|
8
|
+
|
9
|
+
Some `spring`-related gems do not check whether Spring is running and load
|
10
|
+
Spring modules. Thus we have `Spring` defined (and even `Spring.after_fork` defined) but no-op.
|
11
|
+
|
12
|
+
Now we require that `Spring::Applcation` is defined in order to rely on Spring.
|
13
|
+
|
14
|
+
Possibly fixes [#47](https://github.com/palkan/test-prof/issues/47).
|
4
15
|
|
5
16
|
## 0.4.7
|
6
17
|
|
@@ -30,6 +30,8 @@ module Minitest
|
|
30
30
|
private
|
31
31
|
|
32
32
|
def location(group, example = nil)
|
33
|
+
# Minitest::Result (>= 5.11) has `source_location` method
|
34
|
+
return group.source_location if group.respond_to?(:source_location)
|
33
35
|
if group.is_a? Class
|
34
36
|
suite = group.public_instance_methods.select { |mtd| mtd.to_s.match /^test_/ }
|
35
37
|
name = suite.find { |mtd| mtd.to_s == example }
|
data/lib/test_prof.rb
CHANGED
@@ -59,7 +59,7 @@ module TestProf
|
|
59
59
|
# equal to the provided value (if any).
|
60
60
|
# Contains workaround for applications using Spring.
|
61
61
|
def activate(env_var, val = nil)
|
62
|
-
if defined?(::Spring)
|
62
|
+
if defined?(::Spring::Application)
|
63
63
|
::Spring.after_fork { activate!(env_var, val) { yield } }
|
64
64
|
else
|
65
65
|
activate!(env_var, val) { yield }
|
@@ -86,6 +86,14 @@ module TestProf
|
|
86
86
|
res
|
87
87
|
end
|
88
88
|
|
89
|
+
def ignore!
|
90
|
+
@ignored = true
|
91
|
+
end
|
92
|
+
|
93
|
+
def ignore?
|
94
|
+
@ignored == true
|
95
|
+
end
|
96
|
+
|
89
97
|
def within_factory(strategy)
|
90
98
|
return yield if ignore? || !running? || (strategy != :create)
|
91
99
|
|
@@ -108,6 +116,7 @@ module TestProf
|
|
108
116
|
@time = 0.0
|
109
117
|
@count = 0
|
110
118
|
@queries_count = 0
|
119
|
+
@ignored = false
|
111
120
|
end
|
112
121
|
|
113
122
|
def subscribe!
|
@@ -122,10 +131,6 @@ module TestProf
|
|
122
131
|
@depth > 0
|
123
132
|
end
|
124
133
|
|
125
|
-
def ignore?
|
126
|
-
@ignored == true
|
127
|
-
end
|
128
|
-
|
129
134
|
def running?
|
130
135
|
@running == true
|
131
136
|
end
|
@@ -1,12 +1,20 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'minitest/base_reporter'
|
4
|
-
require 'minitest/fd_ignorable'
|
5
4
|
require 'test_prof/ext/float_duration'
|
6
5
|
require 'test_prof/ext/string_strip_heredoc'
|
7
6
|
|
8
7
|
module Minitest
|
9
|
-
module TestProf
|
8
|
+
module TestProf # :nodoc:
|
9
|
+
# Add fd_ignore methods
|
10
|
+
module FactoryDoctorIgnore
|
11
|
+
def fd_ignore
|
12
|
+
::TestProf::FactoryDoctor.ignore!
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
Minitest::Test.include FactoryDoctorIgnore
|
17
|
+
|
10
18
|
class FactoryDoctorReporter < BaseReporter # :nodoc:
|
11
19
|
using ::TestProf::FloatDuration
|
12
20
|
using ::TestProf::StringStripHeredoc
|
@@ -27,13 +35,16 @@ module Minitest
|
|
27
35
|
|
28
36
|
def record(example)
|
29
37
|
::TestProf::FactoryDoctor.stop
|
30
|
-
return if example.skipped? ||
|
38
|
+
return if example.skipped? || ::TestProf::FactoryDoctor.ignore?
|
31
39
|
|
32
40
|
result = ::TestProf::FactoryDoctor.result
|
33
41
|
return unless result.bad?
|
34
42
|
|
43
|
+
# Minitest::Result (>= 5.11) has `klass` method
|
44
|
+
group_name = example.respond_to?(:klass) ? example.klass : example.class.name
|
45
|
+
|
35
46
|
group = {
|
36
|
-
description:
|
47
|
+
description: group_name,
|
37
48
|
location: location_without_line_number(example)
|
38
49
|
}
|
39
50
|
|
data/lib/test_prof/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: test-prof
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vladimir Dementyev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-01-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -135,7 +135,6 @@ files:
|
|
135
135
|
- guides/tests_sampling.md
|
136
136
|
- lib/minitest/base_reporter.rb
|
137
137
|
- lib/minitest/event_prof_formatter.rb
|
138
|
-
- lib/minitest/fd_ignorable.rb
|
139
138
|
- lib/minitest/test_prof_plugin.rb
|
140
139
|
- lib/test-prof.rb
|
141
140
|
- lib/test_prof.rb
|