diff options
author | Rafael França <rafaelmfranca@gmail.com> | 2016-05-10 05:10:23 -0300 |
---|---|---|
committer | Rafael França <rafaelmfranca@gmail.com> | 2016-05-10 05:10:23 -0300 |
commit | 6dec7645192bd89d81d47542255a346f93710830 (patch) | |
tree | e35bfa9ced3e8447f6029dc23c484d033418bf0d /activerecord/test/cases/adapters | |
parent | 6c471becf0c108e95e1ae5844bba6e0d481a139a (diff) | |
parent | 54772667eef242cb550882f155fd16c4eecfe685 (diff) | |
download | rails-6dec7645192bd89d81d47542255a346f93710830.tar.gz rails-6dec7645192bd89d81d47542255a346f93710830.tar.bz2 rails-6dec7645192bd89d81d47542255a346f93710830.zip |
Merge pull request #24950 from kamipo/should_quote_lock_name
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 |