diff options
author | Sean Griffin <sean@seantheprogrammer.com> | 2015-09-22 20:21:55 -0600 |
---|---|---|
committer | Sean Griffin <sean@seantheprogrammer.com> | 2015-09-22 20:21:55 -0600 |
commit | eb52c8979b4e8023f8415e5f8a568e8933ecbd38 (patch) | |
tree | d3637120f0afc615bdae159edb67238cba47b8c3 /activerecord | |
parent | 9f23ee0fdcdc1337e4b489e51053ee1e6037215b (diff) | |
parent | 199d4e28e01ce2e7c54aba69a09557f7b3bf7e4f (diff) | |
download | rails-eb52c8979b4e8023f8415e5f8a568e8933ecbd38.tar.gz rails-eb52c8979b4e8023f8415e5f8a568e8933ecbd38.tar.bz2 rails-eb52c8979b4e8023f8415e5f8a568e8933ecbd38.zip |
Merge pull request #21726 from yui-knk/test/named_bind_arity
Add tests for sanitize named bind arity
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/test/cases/finder_test.rb | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/activerecord/test/cases/finder_test.rb b/activerecord/test/cases/finder_test.rb index 0dc884497c..307b68764e 100644 --- a/activerecord/test/cases/finder_test.rb +++ b/activerecord/test/cases/finder_test.rb @@ -701,12 +701,12 @@ class FinderTest < ActiveRecord::TestCase end def test_bind_arity - assert_nothing_raised { bind '' } + assert_nothing_raised { bind '' } assert_raise(ActiveRecord::PreparedStatementInvalid) { bind '', 1 } assert_raise(ActiveRecord::PreparedStatementInvalid) { bind '?' } - assert_nothing_raised { bind '?', 1 } - assert_raise(ActiveRecord::PreparedStatementInvalid) { bind '?', 1, 1 } + assert_nothing_raised { bind '?', 1 } + assert_raise(ActiveRecord::PreparedStatementInvalid) { bind '?', 1, 1 } end def test_named_bind_variables @@ -721,6 +721,12 @@ class FinderTest < ActiveRecord::TestCase assert_kind_of Time, Topic.where(["id = :id", { id: 1 }]).first.written_on end + def test_named_bind_arity + assert_nothing_raised { bind "name = :name", { name: "37signals" } } + assert_nothing_raised { bind "name = :name", { name: "37signals", id: 1 } } + assert_raise(ActiveRecord::PreparedStatementInvalid) { bind "name = :name", { id: 1 } } + end + class SimpleEnumerable include Enumerable |