db-query-matchers 0.10.0 → 0.11.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: 259419bcb9e506a0600d705b2bb97933ca3d965345291cec676b2f1fba65a4d3
4
- data.tar.gz: 5063b100e71e2b9a33c80c6bf1abaca5d585c5deec32c841b2483c934e39b238
3
+ metadata.gz: 73338487038bc00df6d2f5759be45aff84ee6c589c1579b161135a5e2de9cae5
4
+ data.tar.gz: 7f5c31b6ba9adb14373e3df867c9507a533285129f140b1080229ce7c48ea205
5
5
  SHA512:
6
- metadata.gz: a80f118c26473cc1610a2942d9af65c98185c8c33efedc21b01b9c9374058253ed4e152686224ff86710cfbb7da9bb12af66d3816bbf16f13af029f6494c1b04
7
- data.tar.gz: 3c6cfe00cb95c9c61301177c74e584aba68aa0e8718aeea0dd0a0c510f0cccf8485b4e0b31ceb4597fac9f10f8376ddde349b2f0694e4a59def4ebfba160e514
6
+ metadata.gz: 64b66b5ca748889700ec6f6f923b235755d9a87a7e6a99aed15ee5edf93120667fa7bb3a5aa8fd0b37f645f65500c5e33eaec97daeef665e86165a1f12d6a671
7
+ data.tar.gz: 14334e73100861f885d1319f9681edd4df28a43bc9285d0953537536c8cd20342d713716db47b4a4a8c19680e66ad73b337bcc86dbca8b2f75baa09600c99ea1
@@ -1,13 +1,14 @@
1
1
  module DBQueryMatchers
2
2
  # Configuration for the DBQueryMatcher module.
3
3
  class Configuration
4
- attr_accessor :ignores, :on_query_counted, :schemaless, :log_backtrace, :backtrace_filter, :db_event
4
+ attr_accessor :ignores, :ignore_cached, :on_query_counted, :schemaless, :log_backtrace, :backtrace_filter, :db_event
5
5
 
6
6
  def initialize
7
7
  @db_event = "sql.active_record"
8
8
  @ignores = []
9
9
  @on_query_counted = Proc.new { }
10
10
  @schemaless = false
11
+ @ignore_cached = false
11
12
  @log_backtrace = false
12
13
  @backtrace_filter = Proc.new { |backtrace| backtrace }
13
14
  end
@@ -1,4 +1,3 @@
1
- require 'rspec/core'
2
1
  require 'rspec/expectations'
3
2
 
4
3
  # Custom matcher to check for database queries performed by a block of code.
@@ -35,7 +34,7 @@ RSpec::Matchers.define :make_database_queries do |options = {}|
35
34
 
36
35
  # Taken from ActionView::Helpers::TextHelper
37
36
  def pluralize(count, singular, plural = nil)
38
- word = if count == 1 || count =~ /^1(\.0+)?$/
37
+ word = if count == 1 || count.to_s =~ /^1(\.0+)?$/
39
38
  singular
40
39
  else
41
40
  plural || singular.pluralize
@@ -41,6 +41,7 @@ module DBQueryMatchers
41
41
  def callback(_name, _start, _finish, _message_id, payload)
42
42
  return if @matches && !any_match?(@matches, payload[:sql])
43
43
  return if any_match?(DBQueryMatchers.configuration.ignores, payload[:sql])
44
+ return if DBQueryMatchers.configuration.ignore_cached && payload[:cached]
44
45
  return if DBQueryMatchers.configuration.schemaless && payload[:name] == "SCHEMA"
45
46
 
46
47
  count_query
@@ -1,4 +1,4 @@
1
1
  # Defines the gem version.
2
2
  module DBQueryMatchers
3
- VERSION = '0.10.0'
3
+ VERSION = '0.11.0'
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: db-query-matchers
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.0
4
+ version: 0.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brigade Engineering
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2019-09-26 00:00:00.000000000 Z
13
+ date: 2022-02-23 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.1'
25
25
  type: :runtime
26
26
  prerelease: false
27
27
  version_requirements: !ruby/object:Gem::Requirement
@@ -31,19 +31,19 @@ dependencies:
31
31
  version: '4.0'
32
32
  - - "<"
33
33
  - !ruby/object:Gem::Version
34
- version: '7'
34
+ version: '7.1'
35
35
  - !ruby/object:Gem::Dependency
36
36
  name: rspec
37
37
  requirement: !ruby/object:Gem::Requirement
38
38
  requirements:
39
- - - "~>"
39
+ - - ">="
40
40
  - !ruby/object:Gem::Version
41
41
  version: '3.0'
42
42
  type: :runtime
43
43
  prerelease: false
44
44
  version_requirements: !ruby/object:Gem::Requirement
45
45
  requirements:
46
- - - "~>"
46
+ - - ">="
47
47
  - !ruby/object:Gem::Version
48
48
  version: '3.0'
49
49
  - !ruby/object:Gem::Dependency
@@ -55,7 +55,7 @@ dependencies:
55
55
  version: '4.0'
56
56
  - - "<"
57
57
  - !ruby/object:Gem::Version
58
- version: '7'
58
+ version: '7.1'
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.1'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: sqlite3
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -128,7 +128,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
128
128
  - !ruby/object:Gem::Version
129
129
  version: '0'
130
130
  requirements: []
131
- rubygems_version: 3.0.3
131
+ rubygems_version: 3.1.6
132
132
  signing_key:
133
133
  specification_version: 4
134
134
  summary: RSpec matchers for database queries