Sha256: d6c3af70f78b63c6151d77218df5469d83b9a6f3c6a214412b97dab78e0a338a

Contents?: true

Size: 672 Bytes

Versions: 10

Compression:

Stored size: 672 Bytes

Contents

require 'cases/helper'
require 'models/post'
require 'models/author'

module ActiveRecord
  module Associations
    class AssociationScopeTest < ActiveRecord::TestCase
      test 'does not duplicate conditions' do
        scope = AssociationScope.scope(Author.new.association(:welcome_posts),
                                        Author.connection)
        wheres = scope.where_values.map(&:right)
        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
end

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
ibm_db-3.0.4-x86-mingw32 test/cases/associations/association_scope_test.rb
ibm_db-3.0.4 test/cases/associations/association_scope_test.rb
ibm_db-3.0.3-x86-mingw32 test/cases/associations/association_scope_test.rb
ibm_db-3.0.3 test/cases/associations/association_scope_test.rb
ibm_db-3.0.2-x86-mingw32 test/cases/associations/association_scope_test.rb
ibm_db-3.0.2 test/cases/associations/association_scope_test.rb
activejob-lock-0.0.2 rails/activerecord/test/cases/associations/association_scope_test.rb
ibm_db-3.0.1 test/cases/associations/association_scope_test.rb
ibm_db-3.0.1-x86-mingw32 test/cases/associations/association_scope_test.rb
activejob-lock-0.0.1 rails/activerecord/test/cases/associations/association_scope_test.rb