aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases
diff options
context:
space:
mode:
authorSean Griffin <sean@thoughtbot.com>2014-12-26 15:55:06 -0700
committerSean Griffin <sean@thoughtbot.com>2014-12-26 15:57:18 -0700
commit6d4a19cd503b39bdbefae7c1c527b24ad2e3a36a (patch)
treebf002556781adf62fcec341cce7dd8662555a047 /activerecord/test/cases
parenteac4658bb2b4f27ab0219b4986b711801583c39f (diff)
downloadrails-6d4a19cd503b39bdbefae7c1c527b24ad2e3a36a.tar.gz
rails-6d4a19cd503b39bdbefae7c1c527b24ad2e3a36a.tar.bz2
rails-6d4a19cd503b39bdbefae7c1c527b24ad2e3a36a.zip
Eagerly cast array values passed to the predicate builder
Part of a larger refactoring to remove type casting from Arel. /cc @mrgilman [Sean Griffin & Melanie Gilman]
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r--activerecord/test/cases/relation/where_chain_test.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/activerecord/test/cases/relation/where_chain_test.rb b/activerecord/test/cases/relation/where_chain_test.rb
index 3a02e8230d..f9d3badceb 100644
--- a/activerecord/test/cases/relation/where_chain_test.rb
+++ b/activerecord/test/cases/relation/where_chain_test.rb
@@ -36,7 +36,8 @@ module ActiveRecord
end
def test_not_in
- expected = Post.arel_table[@name].not_in(%w[hello goodbye])
+ values = %w[hello goodbye].map { |v| Arel::Nodes::Quoted.new(v) }
+ expected = Post.arel_table[@name].not_in(values)
relation = Post.where.not(title: %w[hello goodbye])
assert_equal([expected], relation.where_values)
end
@@ -90,7 +91,10 @@ module ActiveRecord
def test_chaining_multiple
relation = Post.where.not(author_id: [1, 2]).where.not(title: 'ruby on rails')
- expected = Post.arel_table['author_id'].not_in([1, 2])
+ expected = Post.arel_table['author_id'].not_in([
+ Arel::Nodes::Quoted.new(1),
+ Arel::Nodes::Quoted.new(2),
+ ])
assert_equal(expected, relation.where_values[0])
value = relation.where_values[1]