test-prof 0.7.4 → 0.7.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/lib/test_prof.rb +10 -0
- data/lib/test_prof/event_prof.rb +3 -2
- data/lib/test_prof/factory_doctor.rb +3 -2
- data/lib/test_prof/factory_prof/factory_builders/factory_bot.rb +19 -1
- data/lib/test_prof/logging.rb +1 -1
- data/lib/test_prof/recipes/logging.rb +3 -1
- data/lib/test_prof/recipes/rspec/before_all.rb +1 -3
- data/lib/test_prof/recipes/rspec/let_it_be.rb +1 -3
- data/lib/test_prof/rspec_dissect.rb +2 -1
- data/lib/test_prof/rspec_stamp.rb +2 -1
- data/lib/test_prof/ruby_prof.rb +4 -2
- data/lib/test_prof/stack_prof.rb +3 -1
- data/lib/test_prof/tag_prof.rb +3 -1
- data/lib/test_prof/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d382abde5291f54f1168e9403e3151aaafbe6e6e7409de394169169a0eca19fe
|
4
|
+
data.tar.gz: 68037c8c7d819c6e68d7e8d4a4291471101539a6239f452e630de5ea0a4648d6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fe73709e9e6d6e609f4a0f705d2de0dbab37daecffeb1bac91a4b1a7585a9f81bc656489e9b84d43ad5a9dd04be93a5b9b1020eecd370cbbfee2d2c2fbc862ce
|
7
|
+
data.tar.gz: 91ff9f2c02b86260c9d0d88b834775528007b05eefa3fb00ba28ce9464dbfc615ae7ddde33f2d7544bfc048602687da078b6d01bd38038609b1ca33bb83500fe
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,12 @@
|
|
2
2
|
|
3
3
|
## master
|
4
4
|
|
5
|
+
## 0.7.5 (2019-02-22)
|
6
|
+
|
7
|
+
- Make `let_it_be` and `before_all` work with `include_context`. ([@palkan][])
|
8
|
+
|
9
|
+
Fixes [#117](https://github.com/palkan/test-prof/issues/117)
|
10
|
+
|
5
11
|
## 0.7.4 (2019-02-16)
|
6
12
|
|
7
13
|
- Add JSON report support for StackProf. ([@palkan][])
|
data/lib/test_prof.rb
CHANGED
@@ -34,6 +34,16 @@ module TestProf
|
|
34
34
|
yield config
|
35
35
|
end
|
36
36
|
|
37
|
+
# Returns true if we're inside RSpec
|
38
|
+
def rspec?
|
39
|
+
defined?(RSpec::Core)
|
40
|
+
end
|
41
|
+
|
42
|
+
# Returns true if we're inside Minitest
|
43
|
+
def minitest?
|
44
|
+
defined?(Minitest)
|
45
|
+
end
|
46
|
+
|
37
47
|
# Avoid issues with wrong time due to monkey-patches (e.g. timecop)
|
38
48
|
# See https://github.com/rspec/rspec-core/blob/v3.6.0/lib/rspec/core.rb#L147
|
39
49
|
#
|
data/lib/test_prof/event_prof.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require "test_prof"
|
3
4
|
require "test_prof/rspec_stamp"
|
4
5
|
require "test_prof/event_prof/profiler"
|
5
6
|
require "test_prof/event_prof/instrumentations/active_support"
|
@@ -103,5 +104,5 @@ module TestProf
|
|
103
104
|
end
|
104
105
|
|
105
106
|
require "test_prof/event_prof/custom_events"
|
106
|
-
require "test_prof/event_prof/rspec" if
|
107
|
-
require "test_prof/event_prof/minitest" if
|
107
|
+
require "test_prof/event_prof/rspec" if TestProf.rspec?
|
108
|
+
require "test_prof/event_prof/minitest" if TestProf.minitest?
|
@@ -1,5 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require "test_prof"
|
3
4
|
require "test_prof/factory_bot"
|
4
5
|
require "test_prof/factory_doctor/factory_bot_patch"
|
5
6
|
|
@@ -139,5 +140,5 @@ module TestProf
|
|
139
140
|
end
|
140
141
|
end
|
141
142
|
|
142
|
-
require "test_prof/factory_doctor/rspec" if
|
143
|
-
require "test_prof/factory_doctor/minitest" if
|
143
|
+
require "test_prof/factory_doctor/rspec" if TestProf.rspec?
|
144
|
+
require "test_prof/factory_doctor/minitest" if TestProf.minitest?
|
@@ -9,6 +9,24 @@ module TestProf
|
|
9
9
|
# implementation of #patch and #track methods
|
10
10
|
# to provide unified interface for all factory-building gems
|
11
11
|
class FactoryBot
|
12
|
+
# FactoryBot 5.0 uses strategy classes for associations,
|
13
|
+
# older versions and top-level invocations use Symbols
|
14
|
+
using(Module.new do
|
15
|
+
refine Symbol do
|
16
|
+
def create?
|
17
|
+
self == :create
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
if defined?(::FactoryBot::Strategy::Create)
|
22
|
+
refine Class do
|
23
|
+
def create?
|
24
|
+
self <= ::FactoryBot::Strategy::Create
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end)
|
29
|
+
|
12
30
|
# Monkey-patch FactoryBot / FactoryGirl
|
13
31
|
def self.patch
|
14
32
|
TestProf::FactoryBot::FactoryRunner.prepend(FactoryBotPatch) if
|
@@ -16,7 +34,7 @@ module TestProf
|
|
16
34
|
end
|
17
35
|
|
18
36
|
def self.track(strategy, factory, &block)
|
19
|
-
return yield unless strategy
|
37
|
+
return yield unless strategy.create?
|
20
38
|
FactoryProf.track(factory, &block)
|
21
39
|
end
|
22
40
|
end
|
data/lib/test_prof/logging.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require "test_prof"
|
3
4
|
require "test_prof/rspec_stamp"
|
4
5
|
require "test_prof/logging"
|
5
6
|
|
@@ -145,7 +146,7 @@ end
|
|
145
146
|
|
146
147
|
require "test_prof/rspec_dissect/collectors/let"
|
147
148
|
require "test_prof/rspec_dissect/collectors/before"
|
148
|
-
require "test_prof/rspec_dissect/rspec" if
|
149
|
+
require "test_prof/rspec_dissect/rspec" if TestProf.rspec?
|
149
150
|
|
150
151
|
TestProf.activate('RD_PROF') do
|
151
152
|
TestProf::RSpecDissect.init
|
@@ -1,5 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require "test_prof"
|
3
4
|
require "test_prof/logging"
|
4
5
|
require "test_prof/rspec_stamp/parser"
|
5
6
|
|
@@ -181,4 +182,4 @@ module TestProf
|
|
181
182
|
end
|
182
183
|
end
|
183
184
|
|
184
|
-
require "test_prof/rspec_stamp/rspec" if
|
185
|
+
require "test_prof/rspec_stamp/rspec" if TestProf.rspec?
|
data/lib/test_prof/ruby_prof.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require "test_prof"
|
4
|
+
|
3
5
|
module TestProf
|
4
6
|
# RubyProf wrapper.
|
5
7
|
#
|
@@ -223,7 +225,7 @@ module TestProf
|
|
223
225
|
end
|
224
226
|
|
225
227
|
def exclude_rspec_methods(profiler)
|
226
|
-
return unless
|
228
|
+
return unless TestProf.rspec?
|
227
229
|
|
228
230
|
RSpecExclusions.generate.each do |klass, mids|
|
229
231
|
profiler.exclude_methods!(klass, *mids)
|
@@ -251,7 +253,7 @@ module TestProf
|
|
251
253
|
end
|
252
254
|
end
|
253
255
|
|
254
|
-
if
|
256
|
+
if TestProf.rspec?
|
255
257
|
require "test_prof/ruby_prof/rspec"
|
256
258
|
require "test_prof/ruby_prof/rspec_exclusions"
|
257
259
|
end
|
data/lib/test_prof/stack_prof.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require "test_prof"
|
4
|
+
|
3
5
|
module TestProf
|
4
6
|
# StackProf wrapper.
|
5
7
|
#
|
@@ -169,7 +171,7 @@ module TestProf
|
|
169
171
|
end
|
170
172
|
end
|
171
173
|
|
172
|
-
require "test_prof/stack_prof/rspec" if
|
174
|
+
require "test_prof/stack_prof/rspec" if TestProf.rspec?
|
173
175
|
|
174
176
|
# Hook to run StackProf globally
|
175
177
|
TestProf.activate('TEST_STACK_PROF') do
|
data/lib/test_prof/tag_prof.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require "test_prof"
|
4
|
+
|
3
5
|
require "test_prof/tag_prof/result"
|
4
6
|
require "test_prof/tag_prof/printers/simple"
|
5
7
|
require "test_prof/tag_prof/printers/html"
|
@@ -9,4 +11,4 @@ module TestProf
|
|
9
11
|
end
|
10
12
|
end
|
11
13
|
|
12
|
-
require "test_prof/tag_prof/rspec" if
|
14
|
+
require "test_prof/tag_prof/rspec" if TestProf.rspec?
|
data/lib/test_prof/version.rb
CHANGED
metadata
CHANGED
@@ -1,27 +1,27 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: test-prof
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vladimir Dementyev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-02-
|
11
|
+
date: 2019-02-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1.10'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.10'
|
27
27
|
- !ruby/object:Gem::Dependency
|
@@ -72,14 +72,14 @@ dependencies:
|
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 0.
|
75
|
+
version: 0.65.0
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 0.
|
82
|
+
version: 0.65.0
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: rubocop-md
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|