From aec4aa1702753f29ae79787c743f6f047ad9a80d Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Mon, 13 Jan 2014 11:50:42 -0800 Subject: check bind parameter uniqueness --- activerecord/test/cases/associations/association_scope_test.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'activerecord/test') diff --git a/activerecord/test/cases/associations/association_scope_test.rb b/activerecord/test/cases/associations/association_scope_test.rb index d38648202e..a5ae3cbb20 100644 --- a/activerecord/test/cases/associations/association_scope_test.rb +++ b/activerecord/test/cases/associations/association_scope_test.rb @@ -7,8 +7,13 @@ module ActiveRecord class AssociationScopeTest < ActiveRecord::TestCase test 'does not duplicate conditions' do association_scope = AssociationScope.new(Author.new.association(:welcome_posts)) - wheres = association_scope.scope.where_values.map(&:right) + scope = association_scope.scope + binds = scope.bind_values.map(&:last) + wheres = scope.where_values.map(&:right).reject { |node| + Arel::Nodes::BindParam === node + } assert_equal wheres.uniq, wheres + assert_equal binds.uniq, binds end end end -- cgit v1.2.3