test-prof 0.12.0 → 1.0.0

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.
@@ -108,8 +108,9 @@ module TestProf
108
108
 
109
109
  LetItBe.module_for(self).module_eval do
110
110
  define_method(identifier) do
111
- # Trying to detect the context (couldn't find other way so far)
112
- if /\(:context\)/.match?(@__inspect_output)
111
+ # Trying to detect the context
112
+ # Based on https://github.com/rspec/rspec-rails/commit/7cb796db064f58da7790a92e73ab906ef50b1f34
113
+ if @__inspect_output.include?("before(:context)") || @__inspect_output.include?("before_all")
113
114
  instance_variable_get(:"#{PREFIX}#{identifier}")
114
115
  else
115
116
  # Fallback to let definition
@@ -11,4 +11,3 @@ require "rubocop"
11
11
 
12
12
  require_relative "cops/inject"
13
13
  require "test_prof/cops/rspec/aggregate_examples"
14
- require "test_prof/cops/rspec/aggregate_failures"
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module TestProf
4
- VERSION = "0.12.0"
4
+ VERSION = "1.0.0"
5
5
  end
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.12.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vladimir Dementyev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-07-17 00:00:00.000000000 Z
11
+ date: 2021-01-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -119,6 +119,7 @@ files:
119
119
  - assets/tagprof.demo.html
120
120
  - assets/tagprof.template.html
121
121
  - config/default.yml
122
+ - config/rubocop-rspec.yml
122
123
  - lib/minitest/base_reporter.rb
123
124
  - lib/minitest/event_prof_formatter.rb
124
125
  - lib/minitest/test_prof_plugin.rb
@@ -126,6 +127,11 @@ files:
126
127
  - lib/test_prof.rb
127
128
  - lib/test_prof/any_fixture.rb
128
129
  - lib/test_prof/any_fixture/dsl.rb
130
+ - lib/test_prof/any_fixture/dump.rb
131
+ - lib/test_prof/any_fixture/dump/base_adapter.rb
132
+ - lib/test_prof/any_fixture/dump/digest.rb
133
+ - lib/test_prof/any_fixture/dump/postgresql.rb
134
+ - lib/test_prof/any_fixture/dump/sqlite.rb
129
135
  - lib/test_prof/before_all.rb
130
136
  - lib/test_prof/before_all/adapters/active_record.rb
131
137
  - lib/test_prof/before_all/isolator.rb
@@ -136,7 +142,6 @@ files:
136
142
  - lib/test_prof/cops/rspec/aggregate_examples/matchers_with_side_effects.rb
137
143
  - lib/test_prof/cops/rspec/aggregate_examples/metadata_helpers.rb
138
144
  - lib/test_prof/cops/rspec/aggregate_examples/node_matchers.rb
139
- - lib/test_prof/cops/rspec/aggregate_failures.rb
140
145
  - lib/test_prof/cops/rspec/language.rb
141
146
  - lib/test_prof/event_prof.rb
142
147
  - lib/test_prof/event_prof/custom_events.rb
@@ -148,7 +153,6 @@ files:
148
153
  - lib/test_prof/event_prof/monitor.rb
149
154
  - lib/test_prof/event_prof/profiler.rb
150
155
  - lib/test_prof/event_prof/rspec.rb
151
- - lib/test_prof/ext/active_record_3.rb
152
156
  - lib/test_prof/ext/active_record_refind.rb
153
157
  - lib/test_prof/ext/array_bsearch_index.rb
154
158
  - lib/test_prof/ext/factory_bot_strategy.rb
@@ -173,8 +177,6 @@ files:
173
177
  - lib/test_prof/factory_prof/printers/flamegraph.rb
174
178
  - lib/test_prof/factory_prof/printers/simple.rb
175
179
  - lib/test_prof/logging.rb
176
- - lib/test_prof/recipes/active_record_one_love.rb
177
- - lib/test_prof/recipes/active_record_shared_connection.rb
178
180
  - lib/test_prof/recipes/logging.rb
179
181
  - lib/test_prof/recipes/minitest/before_all.rb
180
182
  - lib/test_prof/recipes/minitest/sample.rb
@@ -208,15 +210,15 @@ files:
208
210
  - lib/test_prof/utils/rspec.rb
209
211
  - lib/test_prof/utils/sized_ordered_set.rb
210
212
  - lib/test_prof/version.rb
211
- homepage: http://github.com/palkan/test-prof
213
+ homepage: http://github.com/test-prof/test-prof
212
214
  licenses:
213
215
  - MIT
214
216
  metadata:
215
- bug_tracker_uri: http://github.com/palkan/test-prof/issues
216
- changelog_uri: https://github.com/palkan/test-prof/blob/master/CHANGELOG.md
217
+ bug_tracker_uri: http://github.com/test-prof/test-prof/issues
218
+ changelog_uri: https://github.com/test-prof/test-prof/blob/master/CHANGELOG.md
217
219
  documentation_uri: https://test-prof.evilmartians.io/
218
220
  homepage_uri: https://test-prof.evilmartians.io/
219
- source_code_uri: http://github.com/palkan/test-prof
221
+ source_code_uri: http://github.com/test-prof/test-prof
220
222
  post_install_message:
221
223
  rdoc_options: []
222
224
  require_paths:
@@ -1,26 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module RuboCop
4
- module Cop
5
- module RSpec
6
- class AggregateExamples
7
- def self.registry
8
- RuboCop::Cop::Cop.registry
9
- end
10
- end
11
-
12
- class AggregateFailures < AggregateExamples
13
- def initialize(*)
14
- super
15
- self.class.just_once { warn "`AggregateFailures` cop has been renamed to `AggregateExamples`." }
16
- end
17
-
18
- def self.just_once
19
- return if @already_done
20
- yield
21
- @already_done = true
22
- end
23
- end
24
- end
25
- end
26
- end
@@ -1,27 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module TestProf
4
- # Add missing `begin_transaction` and `rollback_transaction` methods
5
- module ActiveRecord3Transactions
6
- refine ::ActiveRecord::ConnectionAdapters::AbstractAdapter do
7
- def begin_transaction(joinable: true)
8
- increment_open_transactions
9
- if open_transactions > 0
10
- create_savepoint
11
- else
12
- begin_db_transaction
13
- end
14
- self.transaction_joinable = joinable
15
- end
16
-
17
- def rollback_transaction(*)
18
- if open_transactions > 1
19
- rollback_to_savepoint
20
- else
21
- rollback_db_transaction
22
- end
23
- decrement_open_transactions
24
- end
25
- end
26
- end
27
- end
@@ -1,6 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "./active_record_shared_connection"
4
-
5
- # One ❤️
6
- TestProf::ActiveRecordOneLove = TestProf::ActiveRecordSharedConnection
@@ -1,77 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module TestProf
4
- # Forces ActiveRecord to use the same connection between threads
5
- module ActiveRecordSharedConnection # :nodoc: all
6
- class << self
7
- attr_reader :connection
8
-
9
- def enable!
10
- self.connection = ActiveRecord::Base.connection
11
- end
12
-
13
- def disable!
14
- self.connection = nil
15
- end
16
-
17
- def ignore(&block)
18
- raise ArgumentError, "Block is required" unless block_given?
19
-
20
- @ignores ||= []
21
-
22
- ignores << block
23
- end
24
-
25
- def ignored?(config)
26
- !ignores.nil? && ignores.any? { |clbk| clbk.call(config) }
27
- end
28
-
29
- private
30
-
31
- attr_reader :ignores
32
-
33
- def connection=(conn)
34
- @connection = conn
35
- connection.singleton_class.prepend Connection
36
- connection
37
- end
38
- end
39
-
40
- module Connection
41
- def shared_lock
42
- @shared_lock ||= Mutex.new
43
- end
44
-
45
- def exec_cache(*)
46
- shared_lock.synchronize { super }
47
- end
48
-
49
- def exec_no_cache(*)
50
- shared_lock.synchronize { super }
51
- end
52
-
53
- def execute(*)
54
- shared_lock.synchronize { super }
55
- end
56
- end
57
-
58
- module Ext
59
- def connection
60
- return super if ActiveRecordSharedConnection.ignored?(connection_config)
61
- ActiveRecordSharedConnection.connection || super
62
- end
63
- end
64
- end
65
- end
66
-
67
- ActiveSupport.on_load(:active_record) do
68
- if ::ActiveRecord::Base.connection.pool.respond_to?(:lock_thread=)
69
- TestProf.log :warn, "You activated ActiveRecordSharedConnection patch for the Rails version,\n" \
70
- "which has a built-in support for the same functionality.\n" \
71
- "Consider removing it, 'cause this could result in unexpected behaviour.\n\n" \
72
- "Read more in the docs: https://test-prof.evilmartians.io/#/active_record_shared_connection"
73
- end
74
-
75
- TestProf::ActiveRecordSharedConnection.enable!
76
- ActiveRecord::Base.singleton_class.prepend TestProf::ActiveRecordSharedConnection::Ext
77
- end