activerecord-pedantmysql2-adapter 1.3.1 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/pedant_mysql2/version.rb +1 -1
- data/lib/pedant_mysql2.rb +5 -3
- data/spec/adapter_spec.rb +7 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: edb5734c15054a4f6e3d985cad3bf2932cb923d5c3c9f9daa0e846dd43a587a6
|
4
|
+
data.tar.gz: 70c44fec9acff6556b13729d54e2004bbe98653975d11b69654bb99b3ffd9d62
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f21453993e5cbe025c65e876de54bedb53082db01ff5551da0e17b902faa48f37fff20cd3e49ec5920038a835339d4e36de0d9570bfe925d4e5577c14c402862
|
7
|
+
data.tar.gz: 830f4252036dd996c2ce76dd6d8f624d324854c27382bc706a8efa2c85c5d080b0dd8f187a4c3654f8e8932128e3f30ecf183573554f181bdcd9ff580e3a9292
|
data/lib/pedant_mysql2.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module PedantMysql2
|
2
4
|
class << self
|
3
5
|
def capture_warnings
|
@@ -46,11 +48,11 @@ module PedantMysql2
|
|
46
48
|
end
|
47
49
|
|
48
50
|
def ignored?(warning)
|
49
|
-
whitelist.any? { |matcher| warning.message.match?(matcher) }
|
51
|
+
note_warning?(warning) || whitelist.any? { |matcher| warning.message.match?(matcher) }
|
50
52
|
end
|
51
53
|
|
52
|
-
def
|
53
|
-
warning.
|
54
|
+
def note_warning?(warning)
|
55
|
+
warning.level == "Note"
|
54
56
|
end
|
55
57
|
|
56
58
|
def setup_capture
|
data/spec/adapter_spec.rb
CHANGED
@@ -42,12 +42,18 @@ describe PedantMysql2 do
|
|
42
42
|
}.to raise_error(MysqlWarning, "Truncated incorrect DOUBLE value: 'foo'")
|
43
43
|
end
|
44
44
|
|
45
|
-
it 'does not raise when warning
|
45
|
+
it 'does not raise when warning is a Note level warning e.g. unexisting table' do
|
46
46
|
expect {
|
47
47
|
execute_with_warning('DROP TABLE IF EXISTS `example_table`')
|
48
48
|
}.to_not raise_error
|
49
49
|
end
|
50
50
|
|
51
|
+
it 'does not raise when warning is a Note level warning e.g. EXPLAIN queries' do
|
52
|
+
expect {
|
53
|
+
execute_with_warning('EXPLAIN SELECT 1')
|
54
|
+
}.to_not raise_error
|
55
|
+
end
|
56
|
+
|
51
57
|
it 'can have a whitelist of warnings' do
|
52
58
|
PedantMysql2.ignore(/Truncated incorrect DOUBLE value/i)
|
53
59
|
expect {
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activerecord-pedantmysql2-adapter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jean Boussier
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-01-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -141,7 +141,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
141
141
|
- !ruby/object:Gem::Version
|
142
142
|
version: '0'
|
143
143
|
requirements: []
|
144
|
-
rubygems_version: 3.
|
144
|
+
rubygems_version: 3.3.3
|
145
145
|
signing_key:
|
146
146
|
specification_version: 4
|
147
147
|
summary: ActiveRecord adapter for MySQL that report warnings.
|