n_plus_one_control 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +6 -2
- data/lib/n_plus_one_control/version.rb +1 -1
- data/n_plus_one_control.gemspec +1 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a9300b0272c34dffc01ce543fb7e57dbcb9687fd
|
4
|
+
data.tar.gz: 02dc0a86bdbbcda81c6cceccbbfcc5e36630c87d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6222cc538fa26cd466757c8fd8bed63cf193311c67086eb546e04ec6c6f8d53bf4e84625ec1285cb065eb7a514e1e3a75e1acf512b2b413d86b5a8ed72bdb233
|
7
|
+
data.tar.gz: 40d1854b93734dc5c141abc8e990476d5e5796888bbe957e974f3527772e754f581685f2b2eef5ec8865557e4a0b0366306bcf80214a0e0f58e84abc539ce5c5
|
data/README.md
CHANGED
@@ -4,6 +4,8 @@
|
|
4
4
|
|
5
5
|
RSpec and Minitest matchers to prevent the N+1 queries problem.
|
6
6
|
|
7
|
+
<img src="https://s3.amazonaws.com/anycable/n_plus_one_control.png" alt="Example output" width="553px">
|
8
|
+
|
7
9
|
### Why yet another gem to assert DB queries?
|
8
10
|
|
9
11
|
Unlike other libraries (such as [db-query-matchers](https://github.com/brigade/db-query-matchers), [rspec-sqlimit](https://github.com/nepalez/rspec-sqlimit), etc), with `n_plus_one_control` you don't have to specify exact expectations to control your code behaviour (e.g. `expect { subject }.to query(2).times`).
|
@@ -12,6 +14,8 @@ Such expectations are rather hard to maintain, 'cause there is a big chance of a
|
|
12
14
|
|
13
15
|
NPlusOneControl works differently. It evaluates the code under consideration several times with different scale factors to make sure that the number of DB queries behaves as expected (i.e. O(1) instead of O(N)).
|
14
16
|
|
17
|
+
So, it's for _performance_ testing and not _feature_ testing.
|
18
|
+
|
15
19
|
### Why not just use [`bullet`](https://github.com/flyerhzm/bullet)?
|
16
20
|
|
17
21
|
Of course, it's possible to use Bullet in tests (see more [here](https://evilmartians.com/chronicles/fighting-the-hydra-of-n-plus-one-queries)), but it's not a _silver bullet_: there can be both false positives and true negatives.
|
@@ -166,7 +170,7 @@ self.event = 'sql.active_record'
|
|
166
170
|
|
167
171
|
## How does it work?
|
168
172
|
|
169
|
-
Take a look at our [Executor](https://github.com/palkan/
|
173
|
+
Take a look at our [Executor](https://github.com/palkan/n_plus_one_control/blob/master/lib/n_plus_one_control/executor.rb) to figure out what's under the hood.
|
170
174
|
|
171
175
|
## What's next?
|
172
176
|
|
@@ -186,7 +190,7 @@ end
|
|
186
190
|
assert_logarithmic_number_of_queries { ... }
|
187
191
|
```
|
188
192
|
|
189
|
-
If you want to discuss or implement any of these, feel free to open an [issue]() or propose a [pull request]().
|
193
|
+
If you want to discuss or implement any of these, feel free to open an [issue](https://github.com/palkan/n_plus_one_control/issues) or propose a [pull request](https://github.com/palkan/n_plus_one_control/pulls).
|
190
194
|
|
191
195
|
## Development
|
192
196
|
|
data/n_plus_one_control.gemspec
CHANGED
@@ -10,6 +10,7 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.email = ["dementiev.vm@gmail.com"]
|
11
11
|
|
12
12
|
spec.summary = "RSpec and Minitest matchers to prevent N+1 queries problem"
|
13
|
+
spec.required_ruby_version = '>= 2.3.0'
|
13
14
|
spec.description = %{
|
14
15
|
RSpec and Minitest matchers to prevent N+1 queries problem.
|
15
16
|
|
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.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- palkan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-06-
|
11
|
+
date: 2017-06-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -188,7 +188,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
188
188
|
requirements:
|
189
189
|
- - ">="
|
190
190
|
- !ruby/object:Gem::Version
|
191
|
-
version:
|
191
|
+
version: 2.3.0
|
192
192
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
193
193
|
requirements:
|
194
194
|
- - ">="
|