Permalink
Browse files

check bind parameter uniqueness

  • Loading branch information...
1 parent 9b5d603 commit aec4aa1702753f29ae79787c743f6f047ad9a80d @tenderlove tenderlove committed Jan 13, 2014
Showing with 6 additions and 1 deletion.
  1. +6 −1 activerecord/test/cases/associations/association_scope_test.rb
@@ -7,8 +7,13 @@ module Associations
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

0 comments on commit aec4aa1

Please sign in to comment.