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 +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +14 -0
- data/lib/n_plus_one_control/executor.rb +1 -0
- data/lib/n_plus_one_control/rspec/matchers/perform_constant_number_of_queries.rb +1 -1
- data/lib/n_plus_one_control/rspec/matchers/perform_linear_number_of_queries.rb +1 -1
- data/lib/n_plus_one_control/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: 95b1fada3d7db7a761650c8cd63b93b93a463dcdbfcf2df2b6e3ea25ac04355a
|
4
|
+
data.tar.gz: 3a3937ad74d66ea0bc0e56b50954c585c36c401b67d9af4dfd2a94e4202ae0be
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9ce963308cf99f1c836e7d883a71dbab0b22f8326692444aa3c6639dfc87065fd3e6866ee1af5b358b42cbc67af4a1640677fc051264c8ba6bc35a1604953bd2
|
7
|
+
data.tar.gz: f914d8e34d49f7ace51c872fde24487f216b481f39b8236b9c7d24bef26530ba5cbd1040b71d0b445a73f5769762e942fd3b00a7d4211a704fa9dcebf3bd34d9
|
data/CHANGELOG.md
CHANGED
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
|
|
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.
|
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-
|
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.
|
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: []
|