activerecord-pedantmysql2-adapter 1.1.2 → 1.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/pedant_mysql2.rb +5 -1
- data/lib/pedant_mysql2/version.rb +1 -1
- data/spec/adapter_spec.rb +8 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fb193accc432a0fed85a527c520afef1f5bf3c43
|
4
|
+
data.tar.gz: b11fe06882e5086459d26f52cd59bcfb6ead0327
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e8146d26e36fa99f37a3c08277da4db95210a3fabc0ad6764dde8de9cefa3751ac1a4f79ee97733cc058ab704878100459c7dc3f5c95b612c803c5a16b5f1fd8
|
7
|
+
data.tar.gz: f950e21b77652402beb3ebd2e7d5786f59f47d97a1568120d7fe19e6b9a84abccdb0fb9f4c53ff0c3eae82f2b4222ebf6a2fab5198128bd69343824c15150027
|
data/lib/pedant_mysql2.rb
CHANGED
@@ -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
|
data/spec/adapter_spec.rb
CHANGED
@@ -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(
|
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.
|
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-
|
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.
|
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.
|