n_plus_one_control 0.6.1 → 0.6.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d9eb89619e16cb318f7c758c355c9578b1bbe10b446aa86a8e6a05402e5a3634
4
- data.tar.gz: c441fc080ac62c150e21877868e8862175b22521d8cb12d3ce240d5153b2d7d7
3
+ metadata.gz: 95b1fada3d7db7a761650c8cd63b93b93a463dcdbfcf2df2b6e3ea25ac04355a
4
+ data.tar.gz: 3a3937ad74d66ea0bc0e56b50954c585c36c401b67d9af4dfd2a94e4202ae0be
5
5
  SHA512:
6
- metadata.gz: 5e5e62dcd9958539060f05f25758a24cfedaa17d3b78a0439c0dc2fbc649c8ba9467371c56aecc78f722c0426daf70db8dea94e5ab8ea86bdc2cfec93c83669a
7
- data.tar.gz: 26cd504b1ca3ed20ce7b25f12a80ab3d8470a1ccefe66bc432af51005bbfd3bc30e3a770a04d7b4f528eac393581f56c2fa044034399c6741f7316b5444b22d2
6
+ metadata.gz: 9ce963308cf99f1c836e7d883a71dbab0b22f8326692444aa3c6639dfc87065fd3e6866ee1af5b358b42cbc67af4a1640677fc051264c8ba6bc35a1604953bd2
7
+ data.tar.gz: f914d8e34d49f7ace51c872fde24487f216b481f39b8236b9c7d24bef26530ba5cbd1040b71d0b445a73f5769762e942fd3b00a7d4211a704fa9dcebf3bd34d9
data/CHANGELOG.md CHANGED
@@ -2,6 +2,11 @@
2
2
 
3
3
  ## master
4
4
 
5
+ ## 0.6.2 (2021-10-26)
6
+
7
+ - Fix .ignore setting (.ignore setting was ignored by the Collector ;-))
8
+ - Fix rspec matchers to allow expectations inside execution block
9
+
5
10
  ## 0.6.1 (2021-03-05)
6
11
 
7
12
  - Ruby 3.0 compatibility. ([@palkan][])
data/README.md CHANGED
@@ -111,6 +111,20 @@ context "N+1", :n_plus_one do
111
111
  end
112
112
  ```
113
113
 
114
+ ### Expectations in execution block
115
+
116
+ Both rspec matchers allows you to put additional expectations inside execution block to ensure that tested piece of code actually does what expected.
117
+
118
+ ```ruby
119
+ context "N+1", :n_plus_one do
120
+ specify do
121
+ expect do
122
+ expect(my_query).to eq(actuall_results)
123
+ end.to perform_constant_number_of_queries
124
+ end
125
+ end
126
+ ```
127
+
114
128
  #### Other available matchers
115
129
 
116
130
  `perform_linear_number_of_queries(slope: 1)` allows you to test that a query generates linear number of queries with the given slope.
@@ -21,6 +21,7 @@ module NPlusOneControl
21
21
 
22
22
  def callback(_name, _start, _finish, _message_id, values) # rubocop:disable Metrics/CyclomaticComplexity,Metrics/LineLength
23
23
  return if %w[CACHE SCHEMA].include? values[:name]
24
+ return if values[:sql].match?(NPlusOneControl.ignore)
24
25
 
25
26
  return unless @pattern.nil? || (values[:sql] =~ @pattern)
26
27
 
@@ -16,7 +16,7 @@
16
16
  @warmup = true
17
17
  end
18
18
 
19
- match do |actual, *_args|
19
+ match(notify_expectation_failures: true) do |actual, *_args|
20
20
  raise ArgumentError, "Block is required" unless actual.is_a? Proc
21
21
 
22
22
  raise "Missing tag :n_plus_one" unless
@@ -16,7 +16,7 @@
16
16
  @warmup = true
17
17
  end
18
18
 
19
- match do |actual, *_args|
19
+ match(notify_expectation_failures: true) do |actual, *_args|
20
20
  raise ArgumentError, "Block is required" unless actual.is_a? Proc
21
21
 
22
22
  raise "Missing tag :n_plus_one" unless
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module NPlusOneControl
4
- VERSION = "0.6.1"
4
+ VERSION = "0.6.2"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: n_plus_one_control
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1
4
+ version: 0.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - palkan
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-03-05 00:00:00.000000000 Z
11
+ date: 2021-10-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -112,7 +112,7 @@ metadata:
112
112
  documentation_uri: http://github.com/palkan/n_plus_one_control
113
113
  homepage_uri: http://github.com/palkan/n_plus_one_control
114
114
  source_code_uri: http://github.com/palkan/n_plus_one_control
115
- post_install_message:
115
+ post_install_message:
116
116
  rdoc_options: []
117
117
  require_paths:
118
118
  - lib
@@ -127,8 +127,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
127
127
  - !ruby/object:Gem::Version
128
128
  version: '0'
129
129
  requirements: []
130
- rubygems_version: 3.0.6
131
- signing_key:
130
+ rubygems_version: 3.0.3
131
+ signing_key:
132
132
  specification_version: 4
133
133
  summary: RSpec and Minitest matchers to prevent N+1 queries problem
134
134
  test_files: []