test-prof 0.10.1 → 0.10.2
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 +5 -0
- data/lib/test_prof/before_all.rb +4 -4
- data/lib/test_prof/event_prof.rb +2 -2
- data/lib/test_prof/event_prof/custom_events.rb +2 -2
- data/lib/test_prof/event_prof/profiler.rb +2 -2
- data/lib/test_prof/recipes/active_record_shared_connection.rb +2 -2
- data/lib/test_prof/recipes/minitest/before_all.rb +2 -2
- data/lib/test_prof/recipes/rspec/let_it_be.rb +1 -1
- data/lib/test_prof/stack_prof.rb +2 -2
- data/lib/test_prof/utils/sized_ordered_set.rb +4 -4
- data/lib/test_prof/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bfc20add611581574506a80294e893a77997e5905ba0fe521838fbdd190b2360
|
4
|
+
data.tar.gz: 6f0505b7f2b96c65624b81ee9fd4c086b387d7c8efdc7150e0409062efd712a7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ca925fb486b3b3e1aff9508b670c19028bfe6b0a5b1c3dfe8d3f69b1de74b8cf19187497eb9c899dfae5cacab8390966a58e08ee2f80705cb62b61b2f002686a
|
7
|
+
data.tar.gz: 65a5ab2c334fdb2625ce450a7184316946cdabe684d052b260e6911648d5f94200e888a083b0b31cb078e4391f106875e0cad145599b7a1a71bfc4cbaf77c10a
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,10 @@
|
|
2
2
|
|
3
3
|
## master (unreleased)
|
4
4
|
|
5
|
+
## 0.10.2 (2020-01-07) 🎄
|
6
|
+
|
7
|
+
- Fix Ruby 2.7 deprecations. ([@lostie][])
|
8
|
+
|
5
9
|
## 0.10.1 (2019-10-17)
|
6
10
|
|
7
11
|
- Fix AnyFixture DSL when using with Rails 6.1+. ([@palkan][])
|
@@ -510,3 +514,4 @@ Fixes [#10](https://github.com/palkan/test-prof/issues/10).
|
|
510
514
|
[@danielwaterworth]: https://github.com/danielwaterworth
|
511
515
|
[@Envek]: https://github.com/Envek
|
512
516
|
[@tyleriguchi]: https://github.com/tyleriguchi
|
517
|
+
[@lostie]: https://github.com/lostie
|
data/lib/test_prof/before_all.rb
CHANGED
@@ -72,18 +72,18 @@ module TestProf
|
|
72
72
|
# `rollback` operation:
|
73
73
|
#
|
74
74
|
# config.before(:rollback) { ... }
|
75
|
-
def before(type)
|
75
|
+
def before(type, &block)
|
76
76
|
validate_hook_type!(type)
|
77
|
-
hooks[type].before <<
|
77
|
+
hooks[type].before << block if block_given?
|
78
78
|
end
|
79
79
|
|
80
80
|
# Add `after` hook for `begin` or
|
81
81
|
# `rollback` operation:
|
82
82
|
#
|
83
83
|
# config.after(:begin) { ... }
|
84
|
-
def after(type)
|
84
|
+
def after(type, &block)
|
85
85
|
validate_hook_type!(type)
|
86
|
-
hooks[type].after <<
|
86
|
+
hooks[type].after << block if block_given?
|
87
87
|
end
|
88
88
|
|
89
89
|
def run_hooks(type) # :nodoc:
|
data/lib/test_prof/event_prof.rb
CHANGED
@@ -95,8 +95,8 @@ module TestProf
|
|
95
95
|
# Use it to profile arbitrary methods:
|
96
96
|
#
|
97
97
|
# TestProf::EventProf.monitor(MyModule, "my_module.call", :call)
|
98
|
-
def monitor(mod, event, *mids)
|
99
|
-
Monitor.call(mod, event, *mids)
|
98
|
+
def monitor(mod, event, *mids, **kwargs)
|
99
|
+
Monitor.call(mod, event, *mids, **kwargs)
|
100
100
|
end
|
101
101
|
end
|
102
102
|
end
|
@@ -5,9 +5,9 @@ module TestProf
|
|
5
5
|
# Registers and activates custom events (which require patches).
|
6
6
|
module CustomEvents
|
7
7
|
class << self
|
8
|
-
def register(event)
|
8
|
+
def register(event, &block)
|
9
9
|
raise ArgumentError, "Block is required!" unless block_given?
|
10
|
-
registrations[event] =
|
10
|
+
registrations[event] = block
|
11
11
|
end
|
12
12
|
|
13
13
|
def activate_all(events)
|
@@ -14,12 +14,12 @@ module TestProf
|
|
14
14
|
self.connection = nil
|
15
15
|
end
|
16
16
|
|
17
|
-
def ignore
|
17
|
+
def ignore(&block)
|
18
18
|
raise ArgumentError, "Block is required" unless block_given?
|
19
19
|
|
20
20
|
@ignores ||= []
|
21
21
|
|
22
|
-
ignores <<
|
22
|
+
ignores << block
|
23
23
|
end
|
24
24
|
|
25
25
|
def ignored?(config)
|
@@ -57,8 +57,8 @@ module TestProf
|
|
57
57
|
module ClassMethods
|
58
58
|
attr_accessor :before_all_executor
|
59
59
|
|
60
|
-
def before_all
|
61
|
-
self.before_all_executor = Executor.new(&
|
60
|
+
def before_all(&block)
|
61
|
+
self.before_all_executor = Executor.new(&block)
|
62
62
|
|
63
63
|
prepend(Module.new do
|
64
64
|
def setup
|
@@ -87,7 +87,7 @@ module TestProf
|
|
87
87
|
|
88
88
|
def self.define_let_it_be_alias(name, **default_args)
|
89
89
|
define_method(name) do |identifier, **options, &blk|
|
90
|
-
let_it_be(identifier, default_args.merge(options), &blk)
|
90
|
+
let_it_be(identifier, **default_args.merge(options), &blk)
|
91
91
|
end
|
92
92
|
end
|
93
93
|
|
data/lib/test_prof/stack_prof.rb
CHANGED
@@ -96,9 +96,9 @@ module TestProf
|
|
96
96
|
|
97
97
|
if block_given?
|
98
98
|
options[:out] = build_path(name)
|
99
|
-
::StackProf.run(options) { yield }
|
99
|
+
::StackProf.run(**options) { yield }
|
100
100
|
else
|
101
|
-
::StackProf.start(options)
|
101
|
+
::StackProf.start(**options)
|
102
102
|
end
|
103
103
|
true
|
104
104
|
end
|
@@ -11,11 +11,11 @@ module TestProf
|
|
11
11
|
|
12
12
|
include Enumerable
|
13
13
|
|
14
|
-
def initialize(max_size, sort_by: nil)
|
14
|
+
def initialize(max_size, sort_by: nil, &block)
|
15
15
|
@max_size = max_size
|
16
16
|
@comparator =
|
17
17
|
if block_given?
|
18
|
-
|
18
|
+
block
|
19
19
|
elsif !sort_by.nil?
|
20
20
|
->(x, y) { x[sort_by] >= y[sort_by] }
|
21
21
|
else
|
@@ -41,9 +41,9 @@ module TestProf
|
|
41
41
|
data.size
|
42
42
|
end
|
43
43
|
|
44
|
-
def each
|
44
|
+
def each(&block)
|
45
45
|
if block_given?
|
46
|
-
data.each(&
|
46
|
+
data.each(&block)
|
47
47
|
else
|
48
48
|
data.each
|
49
49
|
end
|
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.10.
|
4
|
+
version: 0.10.2
|
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: 2020-01-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -86,14 +86,14 @@ dependencies:
|
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: 0.
|
89
|
+
version: 0.77.0
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: 0.
|
96
|
+
version: 0.77.0
|
97
97
|
description: "\n Ruby applications tests profiling tools.\n\n Contains tools
|
98
98
|
to analyze factories usage, integrate with Ruby profilers,\n profile your examples
|
99
99
|
using ActiveSupport notifications (if any) and\n statically analyze your code
|
@@ -223,7 +223,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
223
223
|
- !ruby/object:Gem::Version
|
224
224
|
version: '0'
|
225
225
|
requirements: []
|
226
|
-
rubygems_version: 3.0.
|
226
|
+
rubygems_version: 3.0.6
|
227
227
|
signing_key:
|
228
228
|
specification_version: 4
|
229
229
|
summary: Ruby applications tests profiling tools
|