diff options
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/test/cases/relation/where_chain_test.rb | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/activerecord/test/cases/relation/where_chain_test.rb b/activerecord/test/cases/relation/where_chain_test.rb index 24f6f1d2ab..619055f1e7 100644 --- a/activerecord/test/cases/relation/where_chain_test.rb +++ b/activerecord/test/cases/relation/where_chain_test.rb @@ -24,7 +24,7 @@ module ActiveRecord end def test_not_null - expected = Post.arel_table[@name].not_eq(Arel::Nodes::Quoted.new(nil)) + expected = Post.arel_table[@name].not_eq(nil) relation = Post.where.not(title: nil) assert_equal([expected], relation.where_values) end @@ -36,14 +36,13 @@ module ActiveRecord end def test_not_in - values = %w[hello goodbye].map { |v| Arel::Nodes::Quoted.new(v) } - expected = Post.arel_table[@name].not_in(values) + expected = Post.arel_table[@name].not_in(%w[hello goodbye]) relation = Post.where.not(title: %w[hello goodbye]) assert_equal([expected], relation.where_values) end def test_association_not_eq - expected = Comment.arel_table[@name].not_eq(Arel::Nodes::Quoted.new('hello')) + expected = Comment.arel_table[@name].not_eq('hello') relation = Post.joins(:comments).where.not(comments: {title: 'hello'}) assert_equal(expected.to_sql, relation.where_values.first.to_sql) end @@ -91,10 +90,7 @@ 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([ - Arel::Nodes::Quoted.new(1), - Arel::Nodes::Quoted.new(2), - ]) + expected = Post.arel_table['author_id'].not_in([1, 2]) assert_equal(expected, relation.where_values[0]) value = relation.where_values[1] |