n_plus_one_control 0.7.2 → 0.8.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 62e4c8f58eb8d2e5644c2a99105d17846af7a1d7df6010326ac617b329305af6
4
- data.tar.gz: e2701d8c11ad8744ceb5ce3eb6b54a06e587e595e9a5cdd0203a42fbcb548059
3
+ metadata.gz: 9c4f190c6b3f64c1b5678d73108950769bd160f0c48f2dc58b9436bfef040edf
4
+ data.tar.gz: '00083bbb370b0b5a4fabe3a10204532b386a8f33b8423fa51f3535ee9c0e399f'
5
5
  SHA512:
6
- metadata.gz: 76381aa1bc3f83e407f4cc8694e2133fd1d4b2028dd687c1f9fbb360f7bce943e5aea2939058ba500fcb2a7d7d7498bce484a718a6a7ec85e8de7a300dab7b86
7
- data.tar.gz: f552c915d68172298a2fa2d14b9325d925bce0b2f2d6e431c2e109134528c684cfb68e6da7a48048346b73c3f371f8fa1c969a58f55a0f5fe3e747854481c321
6
+ metadata.gz: 06fec4e71b034083fb6ea116bb9e903fe29a07dff38ba288be59e4f8930987f95e43d734b6621d1ee7a9a817a2a608db83ea7e6dd2adcd25918a7c30b4d5c2ab
7
+ data.tar.gz: 9fb7bf49b3b29ee58a0ff2651329166022d08747809688f00e59edcfa2d12d49610bd0d082809de02132d19a05f8f3550c7a585001555561e5aa9032a672a083
data/CHANGELOG.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  ## master
4
4
 
5
+ ## 0.8.0 (2026-01-28)
6
+
7
+ - Ruby 3.1+ is required.
8
+
9
+ - Added Isolator support.
10
+
5
11
  ## 0.7.2 (2024-08-06)
6
12
 
7
13
  - Add ability to ignore queries cached by the ORM with the new option `ignore_cached_queries` ([@gagalago][])
data/README.md CHANGED
@@ -331,7 +331,7 @@ self.show_table_stats = true
331
331
  # Ignore matching queries
332
332
  NPlusOneControl.ignore = /^(BEGIN|COMMIT|SAVEPOINT|RELEASE)/
333
333
 
334
- # Ignore queries in cache
334
+ # Ignore queries in cache
335
335
  # https://guides.rubyonrails.org/configuring.html#configuring-query-cache
336
336
  NPlusOneControl.ignore_cached_queries = false
337
337
 
@@ -364,7 +364,7 @@ NPlusOneControl.backtrace_cleaner = ->(locations_array) { do_some_filtering(loca
364
364
  NPlusOneControl.backtrace_length = 1
365
365
 
366
366
  # Sometime queries could be too large to provide any meaningful insight.
367
- # You can configure an output length limit for quries in verbose mode by setting the following option
367
+ # You can configure an output length limit for queries in verbose mode by setting the following option
368
368
  # NOTE: It could be specified via NPLUSONE_TRUNCATE env var
369
369
  NPlusOneControl.truncate_query_size = 100
370
370
  ```
@@ -14,12 +14,12 @@ module NPlusOneControl
14
14
  @queries = []
15
15
  ActiveSupport::Notifications
16
16
  .subscribed(method(:callback), NPlusOneControl.event) do
17
- yield
17
+ yield
18
18
  end
19
19
  @queries
20
20
  end
21
21
 
22
- def callback(_name, _start, _finish, _message_id, values) # rubocop:disable Metrics/CyclomaticComplexity,Metrics/LineLength
22
+ def callback(_name, _start, _finish, _message_id, values) # rubocop:disable Metrics/CyclomaticComplexity,Layout/LineLength
23
23
  return if %w[CACHE SCHEMA].include? values[:name]
24
24
  return if values[:sql].match?(NPlusOneControl.ignore)
25
25
  return if values[:cached] && NPlusOneControl.ignore_cached_queries
@@ -12,7 +12,6 @@ module NPlusOneControl
12
12
  scale_factors: nil,
13
13
  warmup: nil
14
14
  )
15
-
16
15
  raise ArgumentError, "Block is required" unless block_given?
17
16
 
18
17
  warming_up warmup
@@ -41,7 +40,6 @@ module NPlusOneControl
41
40
  scale_factors: nil,
42
41
  warmup: nil
43
42
  )
44
-
45
43
  raise ArgumentError, "Block is required" unless block_given?
46
44
 
47
45
  warming_up warmup
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ ::RSpec.configure do |config|
4
+ config.before(:each, :n_plus_one) do
5
+ ::Isolator.incr_thresholds!
6
+ end
7
+
8
+ config.after(:each, :n_plus_one) do
9
+ ::Isolator.decr_thresholds!
10
+ end
11
+ end
@@ -7,6 +7,7 @@ require "n_plus_one_control/rspec/dsl"
7
7
  require "n_plus_one_control/rspec/matchers/perform_constant_number_of_queries"
8
8
  require "n_plus_one_control/rspec/matchers/perform_linear_number_of_queries"
9
9
  require "n_plus_one_control/rspec/context"
10
+ require "n_plus_one_control/rspec/isolator" if defined?(::Isolator)
10
11
 
11
12
  module NPlusOneControl
12
13
  module RSpec # :nodoc:
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module NPlusOneControl
4
- VERSION = "0.7.2"
4
+ VERSION = "0.8.0"
5
5
  end
@@ -6,7 +6,7 @@ require "n_plus_one_control/executor"
6
6
  # RSpec and Minitest matchers to prevent N+1 queries problem.
7
7
  module NPlusOneControl
8
8
  # Used to extract a table name from a query
9
- EXTRACT_TABLE_RXP = /(insert into|update|delete from|from) ['"`](\S+)['"`]/i.freeze
9
+ EXTRACT_TABLE_RXP = /(insert into|update|delete from|from) ['"`](\S+)['"`]/i
10
10
 
11
11
  # Used to convert a query part extracted by the regexp above to the corresponding
12
12
  # human-friendly type
metadata CHANGED
@@ -1,15 +1,28 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: n_plus_one_control
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.2
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - palkan
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2024-08-06 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
12
+ - !ruby/object:Gem::Dependency
13
+ name: benchmark
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - ">="
17
+ - !ruby/object:Gem::Version
18
+ version: '0'
19
+ type: :development
20
+ prerelease: false
21
+ version_requirements: !ruby/object:Gem::Requirement
22
+ requirements:
23
+ - - ">="
24
+ - !ruby/object:Gem::Version
25
+ version: '0'
13
26
  - !ruby/object:Gem::Dependency
14
27
  name: bundler
15
28
  requirement: !ruby/object:Gem::Requirement
@@ -100,6 +113,7 @@ files:
100
113
  - lib/n_plus_one_control/rspec.rb
101
114
  - lib/n_plus_one_control/rspec/context.rb
102
115
  - lib/n_plus_one_control/rspec/dsl.rb
116
+ - lib/n_plus_one_control/rspec/isolator.rb
103
117
  - lib/n_plus_one_control/rspec/matchers/perform_constant_number_of_queries.rb
104
118
  - lib/n_plus_one_control/rspec/matchers/perform_linear_number_of_queries.rb
105
119
  - lib/n_plus_one_control/version.rb
@@ -112,7 +126,6 @@ metadata:
112
126
  documentation_uri: https://github.com/palkan/n_plus_one_control
113
127
  homepage_uri: https://github.com/palkan/n_plus_one_control
114
128
  source_code_uri: https://github.com/palkan/n_plus_one_control
115
- post_install_message:
116
129
  rdoc_options: []
117
130
  require_paths:
118
131
  - lib
@@ -120,15 +133,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
120
133
  requirements:
121
134
  - - ">="
122
135
  - !ruby/object:Gem::Version
123
- version: 2.7.0
136
+ version: 3.1.0
124
137
  required_rubygems_version: !ruby/object:Gem::Requirement
125
138
  requirements:
126
139
  - - ">="
127
140
  - !ruby/object:Gem::Version
128
141
  version: '0'
129
142
  requirements: []
130
- rubygems_version: 3.4.19
131
- signing_key:
143
+ rubygems_version: 3.6.9
132
144
  specification_version: 4
133
145
  summary: RSpec and Minitest matchers to prevent N+1 queries problem
134
146
  test_files: []