ar-query-matchers 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +4 -1
  3. data/README.md +11 -10
  4. metadata +11 -11
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5265f76d235538ee76fd8ed78d460357bd35efc1b9f96286cd674c646dfa9080
4
- data.tar.gz: 368284e4b46d07c1331805e1224f15f66f82757a69dcc2d2eccb097331e154e9
3
+ metadata.gz: 60c088b5a136a27e7cda68a413f8a46005c82f63ff30bb22eaadf70995390755
4
+ data.tar.gz: 2be1beb74c5716601305bd6771fb2f9ba8058879a609dcb4198c640a1a5f7cd9
5
5
  SHA512:
6
- metadata.gz: 6b6f19694c17e3462faccfcb5928e907a269947264f2a9902d7bcfb4a5ea0c88aeb99deff97198abbe5f42d25d6f844dcdff738967ef783e6a1230cadb3ce0aa
7
- data.tar.gz: 55615a4c940d4dfdfbba8625fea16bcc64c537e31c31f690fc7fcc1d2b3ca7a775d5b68e145e472a478b0c8a787239fdc3c2cb8d42fbf66fcf581231499b4131
6
+ metadata.gz: 24c9812af618e31c66520d52d79e6a7bf0b6695c8e99323136877061bcac6045f795bc4655af35d9aeca49bd2ed129b0227bc717544e4c5007df1493fb9fa65c
7
+ data.tar.gz: c6905a488bde5a20cd45cb636d59d9c0dcf2b459cbafda156da918a0fa4a71866b60ee014ede6ec242539ced60f6915ccbecb56848b411bda97ca8d6eb0b4a5f
@@ -5,6 +5,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5
5
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
7
  ## [Unreleased]
8
+ ## [0.3.0] - 2020-03-13
9
+
10
+ - Correct the Rails dependency to allow for Rails 6.0
8
11
 
9
12
  ## [0.2.0] - 2019-09-15
10
13
  ### Changed
@@ -17,4 +20,4 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
17
20
 
18
21
  [Unreleased]: https://github.com/gusto/ar-query-matchers/compare/v0.2.0...HEAD
19
22
  [0.2.0]: https://github.com/gusto/ar-query-matchers/releases/tag/v0.2.0
20
- [0.1.0]: https://github.com/gusto/ar-query-matchers/releases/tag/v0.1.0
23
+ [0.1.0]: https://github.com/gusto/ar-query-matchers/releases/tag/v0.1.0
data/README.md CHANGED
@@ -1,25 +1,28 @@
1
1
  ## AR Query Matchers
2
2
  ![badge](https://action-badges.now.sh/gusto/ar-query-matchers?action=Run%20Tests)
3
3
 
4
- These RSpec matchers allows guarding against N+1 queries by specifying
4
+ These RSpec matchers allow guarding against N+1 queries by specifying
5
5
  exactly how many queries you expect each of your ActiveRecord models to perform.
6
6
 
7
- They also help us reason about the type of record interactions happening in a block of code.
7
+ They could also help reasoning about which database interactions are happening inside a block of code.
8
8
 
9
9
  This pattern is a based on how Rails itself tests queries:
10
10
  https://github.com/rails/rails/blob/ac2bc00482c1cf47a57477edb6ab1426a3ba593c/activerecord/test/cases/test_case.rb#L104-L141
11
11
 
12
+ Currently, this gem only supports RSpec matchers, but the code is meant to be adapted to support other testing frameworks.
13
+ If you'd like to pick that up, please have a look at: https://github.com/Gusto/ar-query-matchers/issues/13
14
+
12
15
  ### Usage
13
16
  Include it in your Gemfile:
14
17
  ```ruby
15
18
  group :test do
16
- gem 'ar-query-matchers', '~> 0.1.0', require: false
19
+ gem 'ar-query-matchers', '~> 0.2.0', require: false
17
20
  end
18
21
  ```
19
22
 
20
23
  Start using it:
21
24
  ```ruby
22
- require 'ar-query-matchers'
25
+ require 'ar_query_matchers'
23
26
 
24
27
  RSpec.describe Employee do
25
28
  it 'creating an employee creates exactly one record' do
@@ -31,7 +34,7 @@ end
31
34
  ```
32
35
 
33
36
  ### Matchers
34
- This module defines a few categories of matchers:
37
+ This gem defines a few categories of matchers:
35
38
  - **Create**: Which models are created during a block
36
39
  - **Load**: Which models are fetched during a block
37
40
  - **Update**: Which models are updated during a block
@@ -55,7 +58,7 @@ expect { some_code() }.to only_load_models(
55
58
  )
56
59
  ```
57
60
 
58
- The following spec will pass only if there are exactly no select queries.
61
+ The following spec will pass only if there are no select queries.
59
62
  ```ruby
60
63
  expect { some_code() }.to not_load_models
61
64
  ```
@@ -84,11 +87,9 @@ Expected to run queries to load models exactly {"Address"=>1, "Payroll"=>1, "Use
84
87
  ```
85
88
 
86
89
  ### High Level Design:
87
- The RSpec matcher delegates to the query counters, asserts expectations and formats error messages to provide meaningful failures.
88
-
89
-
90
+ The RSpec matcher delegates to "query counters", asserts expectations and formats error messages to provide meaningful failures.
90
91
  The matchers are pretty simple, and delegate instrumentation into specialized QueryCounter classes.
91
- The QueryCounters are different classes instruments a ruby block by listening on all sql, parsing the queries and returning structured data describing the interactions.
92
+ The QueryCounters are different classes which instrument a ruby block by listening on all sql, parsing the queries and returning structured data describing the interactions.
92
93
 
93
94
  ```
94
95
  ┌────────────────────────────────────────────────────────────────────────────────────────┐
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ar-query-matchers
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matan Zruya
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-09-15 00:00:00.000000000 Z
11
+ date: 2020-03-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -17,9 +17,9 @@ dependencies:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '4.0'
20
- - - "<="
20
+ - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: '6.0'
22
+ version: '6.1'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -27,9 +27,9 @@ dependencies:
27
27
  - - ">="
28
28
  - !ruby/object:Gem::Version
29
29
  version: '4.0'
30
- - - "<="
30
+ - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: '6.0'
32
+ version: '6.1'
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: activesupport
35
35
  requirement: !ruby/object:Gem::Requirement
@@ -37,9 +37,9 @@ dependencies:
37
37
  - - ">="
38
38
  - !ruby/object:Gem::Version
39
39
  version: '4.0'
40
- - - "<="
40
+ - - "<"
41
41
  - !ruby/object:Gem::Version
42
- version: '6.0'
42
+ version: '6.1'
43
43
  type: :runtime
44
44
  prerelease: false
45
45
  version_requirements: !ruby/object:Gem::Requirement
@@ -47,9 +47,9 @@ dependencies:
47
47
  - - ">="
48
48
  - !ruby/object:Gem::Version
49
49
  version: '4.0'
50
- - - "<="
50
+ - - "<"
51
51
  - !ruby/object:Gem::Version
52
- version: '6.0'
52
+ version: '6.1'
53
53
  - !ruby/object:Gem::Dependency
54
54
  name: rspec
55
55
  requirement: !ruby/object:Gem::Requirement
@@ -148,7 +148,7 @@ dependencies:
148
148
  - - ">="
149
149
  - !ruby/object:Gem::Version
150
150
  version: '0'
151
- description: These RSpec matchers allows guarding against N+1 queries by specifying
151
+ description: These RSpec matchers allow guarding against N+1 queries by specifying
152
152
  exactly how many queries you expect each of your ActiveRecord models to perform.
153
153
  email:
154
154
  - mzruya@gmail.com