diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2017-05-04 05:14:02 +0900 |
---|---|---|
committer | Ryuta Kamizono <kamipo@gmail.com> | 2017-05-04 05:14:02 +0900 |
commit | a568a820d23543defe3c8a1e28c9aac97ca9daae (patch) | |
tree | 682a5a5d25a9212d6164b749797f2228c20cbb7c /activerecord/test | |
parent | 184c3d3ac206d246d692556c2c71aad411ee6f1e (diff) | |
download | rails-a568a820d23543defe3c8a1e28c9aac97ca9daae.tar.gz rails-a568a820d23543defe3c8a1e28c9aac97ca9daae.tar.bz2 rails-a568a820d23543defe3c8a1e28c9aac97ca9daae.zip |
Should test against `Relation#bound_attributes`
Since legacy `Relation#bind_values` was removed in b06f64c.
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/relations_test.rb | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/activerecord/test/cases/relations_test.rb b/activerecord/test/cases/relations_test.rb index e72e9f62ef..81173945a3 100644 --- a/activerecord/test/cases/relations_test.rb +++ b/activerecord/test/cases/relations_test.rb @@ -1981,24 +1981,28 @@ class RelationTest < ActiveRecord::TestCase end def test_unscope_removes_binds - left = Post.where(id: Arel::Nodes::BindParam.new) - column = Post.columns_hash["id"] - left.bind_values += [[column, 20]] + left = Post.where(id: 20) + + binds = [bind_attribute("id", 20, Post.type_for_attribute("id"))] + assert_equal binds, left.bound_attributes relation = left.unscope(where: :id) - assert_equal [], relation.bind_values + assert_equal [], relation.bound_attributes end - def test_merging_removes_rhs_bind_parameters + def test_merging_removes_rhs_binds left = Post.where(id: 20) right = Post.where(id: [1, 2, 3, 4]) + binds = [bind_attribute("id", 20, Post.type_for_attribute("id"))] + assert_equal binds, left.bound_attributes + merged = left.merge(right) - assert_equal [], merged.bind_values + assert_equal [], merged.bound_attributes end - def test_merging_keeps_lhs_bind_parameters - binds = [ActiveRecord::Relation::QueryAttribute.new("id", 20, Post.type_for_attribute("id"))] + def test_merging_keeps_lhs_binds + binds = [bind_attribute("id", 20, Post.type_for_attribute("id"))] right = Post.where(id: 20) left = Post.where(id: 10) |