db-query-matchers 0.11.0 → 0.13.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: 73338487038bc00df6d2f5759be45aff84ee6c589c1579b161135a5e2de9cae5
4
- data.tar.gz: 7f5c31b6ba9adb14373e3df867c9507a533285129f140b1080229ce7c48ea205
3
+ metadata.gz: 9a1b6e8a8074aea4771346ce2fae17f14c1bf7eeca26789b64dc08ecc72d247b
4
+ data.tar.gz: '08f1a1793e7c58ac4997afa956a115c3323c058cf553d620375fdc67927d040a'
5
5
  SHA512:
6
- metadata.gz: 64b66b5ca748889700ec6f6f923b235755d9a87a7e6a99aed15ee5edf93120667fa7bb3a5aa8fd0b37f645f65500c5e33eaec97daeef665e86165a1f12d6a671
7
- data.tar.gz: 14334e73100861f885d1319f9681edd4df28a43bc9285d0953537536c8cd20342d713716db47b4a4a8c19680e66ad73b337bcc86dbca8b2f75baa09600c99ea1
6
+ metadata.gz: 9b37a31f258118f6a5d2b89817723fcc7bf529e5ccdbc59b7f35ad4548af4798960c77a6eb16f022c6e40bb80abc1c32dfce73c2943771370d1d8bb120bae0c6
7
+ data.tar.gz: 02b151cd144718de97db150800c722f595aae71866ea5030711df700bb273a65d62c1860e52603a952b1682d15614760ac4d0733fa99e5f40295eec85ceb3f18
@@ -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]
@@ -1,4 +1,4 @@
1
1
  # Defines the gem version.
2
2
  module DBQueryMatchers
3
- VERSION = '0.11.0'
3
+ VERSION = '0.13.0'
4
4
  end
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.11.0
4
+ version: 0.13.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: 2022-02-23 00:00:00.000000000 Z
13
+ date: 2024-08-14 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.1'
24
+ version: '7.3'
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.1'
34
+ version: '7.3'
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.1'
58
+ version: '7.3'
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.1'
68
+ version: '7.3'
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
@@ -112,8 +112,9 @@ files:
112
112
  homepage: https://github.com/brigade/db-query-matchers
113
113
  licenses:
114
114
  - MIT
115
- metadata: {}
116
- post_install_message:
115
+ metadata:
116
+ changelog_uri: https://github.com/sds/db-query-matchers/blob/main/CHANGELOG.md
117
+ post_install_message:
117
118
  rdoc_options: []
118
119
  require_paths:
119
120
  - lib
@@ -121,15 +122,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
121
122
  requirements:
122
123
  - - ">="
123
124
  - !ruby/object:Gem::Version
124
- version: 1.9.2
125
+ version: '3.0'
125
126
  required_rubygems_version: !ruby/object:Gem::Requirement
126
127
  requirements:
127
128
  - - ">="
128
129
  - !ruby/object:Gem::Version
129
130
  version: '0'
130
131
  requirements: []
131
- rubygems_version: 3.1.6
132
- signing_key:
132
+ rubygems_version: 3.5.9
133
+ signing_key:
133
134
  specification_version: 4
134
135
  summary: RSpec matchers for database queries
135
136
  test_files: []