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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '0191edcf1291b66b644b0ee2aae2c192559dda880347270f4bac423ff0dae468'
4
- data.tar.gz: ddbb36a60520e44f314416fbfac0bbef65cd89c7f2b6f7ecd0c13468c6a9d9d9
3
+ metadata.gz: edb5734c15054a4f6e3d985cad3bf2932cb923d5c3c9f9daa0e846dd43a587a6
4
+ data.tar.gz: 70c44fec9acff6556b13729d54e2004bbe98653975d11b69654bb99b3ffd9d62
5
5
  SHA512:
6
- metadata.gz: 70a10d0462324fddae3d76bc4e74fb0f62b7db8f4a65c3153ce7b5ce03b897ce7587ea402122a5b2226abf6412c9aa4367c2316f82bb1c7589548a582de24cbd
7
- data.tar.gz: 90050a09ffec4d32945213f19360a11f3b993ef858806f465d57822d4dadb5d57281d84d60b46fac2a16a16b29b0d11bf77d344bbd213124b00c910e697fae48
6
+ metadata.gz: f21453993e5cbe025c65e876de54bedb53082db01ff5551da0e17b902faa48f37fff20cd3e49ec5920038a835339d4e36de0d9570bfe925d4e5577c14c402862
7
+ data.tar.gz: 830f4252036dd996c2ce76dd6d8f624d324854c27382bc706a8efa2c85c5d080b0dd8f187a4c3654f8e8932128e3f30ecf183573554f181bdcd9ff580e3a9292
@@ -1,3 +1,3 @@
1
1
  module PedantMysql2
2
- VERSION = '1.3.1'
2
+ VERSION = '1.4.0'
3
3
  end
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) } || drop_table_warning(warning)
51
+ note_warning?(warning) || whitelist.any? { |matcher| warning.message.match?(matcher) }
50
52
  end
51
53
 
52
- def drop_table_warning(warning)
53
- warning.query.match?(/\ADROP TABLE IF EXISTS/) || warning.message.match?(/\AUnknown table/)
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 warns about unexisting table' do
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.3.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: 2022-03-01 00:00:00.000000000 Z
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.2.20
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.