Sha256: 1321ab1b43faf80bb5b0d5543537234fb2586d083d3c962905e71ef0173e652c
Contents?: true
Size: 1.09 KB
Versions: 17
Compression:
Stored size: 1.09 KB
Contents
require File.expand_path('../abstract_unit', __FILE__) class TestEqual < ActiveSupport::TestCase fixtures :departments include CompositePrimaryKeys::Predicates def test_or dep = Arel::Table.new(:departments) predicates = Array.new 3.times do |i| predicates << dep[:id].eq(i) end connection = ActiveRecord::Base.connection quoted = "#{connection.quote_table_name('departments')}.#{connection.quote_column_name('id')}" expected = "((#{quoted} = 0) OR (#{quoted} = 1) OR (#{quoted} = 2))" pred = cpk_or_predicate(predicates) assert_equal(with_quoted_identifiers(expected), pred.to_sql) end def test_and dep = Arel::Table.new(:departments) predicates = Array.new 3.times do |i| predicates << dep[:id].eq(i) end connection = ActiveRecord::Base.connection quoted = "#{connection.quote_table_name('departments')}.#{connection.quote_column_name('id')}" expected = "#{quoted} = 0 AND #{quoted} = 1 AND #{quoted} = 2" pred = cpk_and_predicate(predicates) assert_equal(with_quoted_identifiers(expected), pred.to_sql) end end
Version data entries
17 entries across 17 versions & 1 rubygems