activerecord-pedantmysql2-adapter 1.1.2 → 1.1.3

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
  SHA1:
3
- metadata.gz: 9d494c02a52cb2aac4d27b0023603f8508b412f6
4
- data.tar.gz: c9aeafa57eaa2bfa596c30ee54eaf3862ab98f9f
3
+ metadata.gz: fb193accc432a0fed85a527c520afef1f5bf3c43
4
+ data.tar.gz: b11fe06882e5086459d26f52cd59bcfb6ead0327
5
5
  SHA512:
6
- metadata.gz: 50ab85d2c548b1aa4132e1923dba96b262fa2aa8cb0d4a58b22f0e30ca13b207fd94a4c418e9107c4a2cb8dd5f72c300227c68e3eeb48a18641e16a9e032fac5
7
- data.tar.gz: 467fe6fe8bd380364bb1266680634d7630ba485dab2542965f64e835de446a7a018429b5e9a110afd239aaa40de9f107a14d2b1aa2068026c5d1af68cca3b550
6
+ metadata.gz: e8146d26e36fa99f37a3c08277da4db95210a3fabc0ad6764dde8de9cefa3751ac1a4f79ee97733cc058ab704878100459c7dc3f5c95b612c803c5a16b5f1fd8
7
+ data.tar.gz: f950e21b77652402beb3ebd2e7d5786f59f47d97a1568120d7fe19e6b9a84abccdb0fb9f4c53ff0c3eae82f2b4222ebf6a2fab5198128bd69343824c15150027
@@ -46,7 +46,11 @@ module PedantMysql2
46
46
  end
47
47
 
48
48
  def ignored?(warning)
49
- whitelist.any? { |matcher| matcher =~ warning.message }
49
+ whitelist.any? { |matcher| matcher =~ warning.message } || drop_table_warning(warning)
50
+ end
51
+
52
+ def drop_table_warning(warning)
53
+ warning.query =~ /\ADROP TABLE IF EXISTS/ || warning.message =~ /\AUnknown table/
50
54
  end
51
55
 
52
56
  def setup_capture
@@ -1,3 +1,3 @@
1
1
  module PedantMysql2
2
- VERSION = '1.1.2'
2
+ VERSION = '1.1.3'
3
3
  end
@@ -19,8 +19,8 @@ describe PedantMysql2 do
19
19
  PedantMysql2.on_warning = @original_callback
20
20
  end
21
21
 
22
- def execute_with_warning
23
- ActiveRecord::Base.connection.execute('SELECT 1 + "foo"')
22
+ def execute_with_warning(query = 'SELECT 1 + "foo"')
23
+ ActiveRecord::Base.connection.execute(query)
24
24
  end
25
25
 
26
26
  def wait_for(thread)
@@ -42,6 +42,12 @@ 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
46
+ expect {
47
+ execute_with_warning('DROP TABLE IF EXISTS `example_table`')
48
+ }.to_not raise_error
49
+ end
50
+
45
51
  it 'can have a whitelist of warnings' do
46
52
  PedantMysql2.ignore(/Truncated incorrect DOUBLE value/i)
47
53
  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.1.2
4
+ version: 1.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jean Boussier
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-20 00:00:00.000000000 Z
11
+ date: 2017-07-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -158,7 +158,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
158
158
  version: '0'
159
159
  requirements: []
160
160
  rubyforge_project:
161
- rubygems_version: 2.6.10
161
+ rubygems_version: 2.5.2
162
162
  signing_key:
163
163
  specification_version: 4
164
164
  summary: ActiveRecord adapter for MySQL that report warnings.