db-query-matchers 0.11.0 → 0.12.0
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2b37f98f126a66fccfb65384d72b9cf24d4b927f223288a77ac3a0bf39f780d7
|
4
|
+
data.tar.gz: 18743b2775714eb1ef68786134459192a0362fc7e283aae67d786da9da0ea390
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b46e4f4211bbd5e40ee1fd7bf18e7a9365119eaec452b0a4dd220907e33f35c3195dc4413e0cd22a1c8f22b08b050cec43d59751013b80e9721e38635ecd7edd
|
7
|
+
data.tar.gz: 1a8b8f4a9f1eba742d42e40cc1692d8718d7a7860afd9949dd1cc5583abaecca7c5c0afa6abf8f7c8dc1269d7b9e5909e2c48333947e760c4b4d6ece5f010863
|
@@ -69,6 +69,8 @@ RSpec::Matchers.define :make_database_queries do |options = {}|
|
|
69
69
|
counter_options[:matches] << Regexp.new(Regexp.escape(options[:matching]))
|
70
70
|
end
|
71
71
|
end
|
72
|
+
|
73
|
+
counter_options[:database_role] = options[:database_role]
|
72
74
|
@counter = DBQueryMatchers::QueryCounter.new(counter_options)
|
73
75
|
ActiveSupport::Notifications.subscribed(@counter.to_proc,
|
74
76
|
DBQueryMatchers.configuration.db_event,
|
@@ -18,6 +18,7 @@ module DBQueryMatchers
|
|
18
18
|
|
19
19
|
def initialize(options = {})
|
20
20
|
@matches = options[:matches]
|
21
|
+
@database_role = options[:database_role]
|
21
22
|
@count = 0
|
22
23
|
@log = []
|
23
24
|
end
|
@@ -39,6 +40,7 @@ module DBQueryMatchers
|
|
39
40
|
# @param _message_id [String] unique ID for this notification
|
40
41
|
# @param payload [Hash] the payload
|
41
42
|
def callback(_name, _start, _finish, _message_id, payload)
|
43
|
+
return if @database_role && (ActiveRecord::Base.current_role != @database_role)
|
42
44
|
return if @matches && !any_match?(@matches, payload[:sql])
|
43
45
|
return if any_match?(DBQueryMatchers.configuration.ignores, payload[:sql])
|
44
46
|
return if DBQueryMatchers.configuration.ignore_cached && payload[:cached]
|
metadata
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: db-query-matchers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.12.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brigade Engineering
|
8
8
|
- Henric Trotzig
|
9
9
|
- Joe Lencioni
|
10
|
-
autorequire:
|
10
|
+
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2023-12-13 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activesupport
|
@@ -21,7 +21,7 @@ dependencies:
|
|
21
21
|
version: '4.0'
|
22
22
|
- - "<"
|
23
23
|
- !ruby/object:Gem::Version
|
24
|
-
version: '7.
|
24
|
+
version: '7.2'
|
25
25
|
type: :runtime
|
26
26
|
prerelease: false
|
27
27
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -31,7 +31,7 @@ dependencies:
|
|
31
31
|
version: '4.0'
|
32
32
|
- - "<"
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version: '7.
|
34
|
+
version: '7.2'
|
35
35
|
- !ruby/object:Gem::Dependency
|
36
36
|
name: rspec
|
37
37
|
requirement: !ruby/object:Gem::Requirement
|
@@ -55,7 +55,7 @@ dependencies:
|
|
55
55
|
version: '4.0'
|
56
56
|
- - "<"
|
57
57
|
- !ruby/object:Gem::Version
|
58
|
-
version: '7.
|
58
|
+
version: '7.2'
|
59
59
|
type: :development
|
60
60
|
prerelease: false
|
61
61
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -65,7 +65,7 @@ dependencies:
|
|
65
65
|
version: '4.0'
|
66
66
|
- - "<"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '7.
|
68
|
+
version: '7.2'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: sqlite3
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -94,7 +94,7 @@ dependencies:
|
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '2.0'
|
97
|
-
description:
|
97
|
+
description:
|
98
98
|
email:
|
99
99
|
- eng@brigade.com
|
100
100
|
- henric.trotzig@brigade.com
|
@@ -113,7 +113,7 @@ homepage: https://github.com/brigade/db-query-matchers
|
|
113
113
|
licenses:
|
114
114
|
- MIT
|
115
115
|
metadata: {}
|
116
|
-
post_install_message:
|
116
|
+
post_install_message:
|
117
117
|
rdoc_options: []
|
118
118
|
require_paths:
|
119
119
|
- lib
|
@@ -121,15 +121,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
121
121
|
requirements:
|
122
122
|
- - ">="
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version:
|
124
|
+
version: '3.0'
|
125
125
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
126
126
|
requirements:
|
127
127
|
- - ">="
|
128
128
|
- !ruby/object:Gem::Version
|
129
129
|
version: '0'
|
130
130
|
requirements: []
|
131
|
-
rubygems_version: 3.
|
132
|
-
signing_key:
|
131
|
+
rubygems_version: 3.4.10
|
132
|
+
signing_key:
|
133
133
|
specification_version: 4
|
134
134
|
summary: RSpec matchers for database queries
|
135
135
|
test_files: []
|