aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/associations/association_scope_test.rb
blob: f9793277e5bcc8ac97f729d040b3afd81d4f7cf4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
require 'cases/helper'
require 'models/post'
require 'models/author'

module ActiveRecord
  module Associations
    class AssociationScopeTest < ActiveRecord::TestCase
      test 'does not duplicate conditions' do
        association_scope = AssociationScope.new
        scope = association_scope.scope(Author.new.association(:welcome_posts),
                                        Author.connection)
        wheres = scope.where_values.map(&:right)
        assert_equal wheres.uniq, wheres
      end
    end
  end
end