diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2016-05-10 16:12:25 +0900 |
---|---|---|
committer | Ryuta Kamizono <kamipo@gmail.com> | 2016-05-10 16:14:45 +0900 |
commit | 54772667eef242cb550882f155fd16c4eecfe685 (patch) | |
tree | 466c282836eb6ac9c90b3fac852ef8f62b566187 /activerecord/test/cases/adapters | |
parent | 164125c88e3a3adb363b469cd72c9d0bd22dcad8 (diff) | |
download | rails-54772667eef242cb550882f155fd16c4eecfe685.tar.gz rails-54772667eef242cb550882f155fd16c4eecfe685.tar.bz2 rails-54772667eef242cb550882f155fd16c4eecfe685.zip |
Should quote `lock_name` to pass to `get_advisory_lock`
Diffstat (limited to 'activerecord/test/cases/adapters')
-rw-r--r-- | activerecord/test/cases/adapters/mysql2/connection_test.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/activerecord/test/cases/adapters/mysql2/connection_test.rb b/activerecord/test/cases/adapters/mysql2/connection_test.rb index c4715393b3..fe610ae951 100644 --- a/activerecord/test/cases/adapters/mysql2/connection_test.rb +++ b/activerecord/test/cases/adapters/mysql2/connection_test.rb @@ -144,7 +144,7 @@ class Mysql2ConnectionTest < ActiveRecord::Mysql2TestCase end def test_get_and_release_advisory_lock - lock_name = "test_lock_name" + lock_name = "test lock'n'name" got_lock = @connection.get_advisory_lock(lock_name) assert got_lock, "get_advisory_lock should have returned true but it didn't" @@ -159,7 +159,7 @@ class Mysql2ConnectionTest < ActiveRecord::Mysql2TestCase end def test_release_non_existent_advisory_lock - lock_name = "fake_lock_name" + lock_name = "fake lock'n'name" released_non_existent_lock = @connection.release_advisory_lock(lock_name) assert_equal released_non_existent_lock, false, 'expected release_advisory_lock to return false when there was no lock to release' @@ -168,6 +168,6 @@ class Mysql2ConnectionTest < ActiveRecord::Mysql2TestCase protected def test_lock_free(lock_name) - @connection.select_value("SELECT IS_FREE_LOCK('#{lock_name}');") == 1 + @connection.select_value("SELECT IS_FREE_LOCK(#{@connection.quote(lock_name)})") == 1 end end |