Sha256: 8a661b11c2afaaa02a599638033b976102b3135ca2029c2bf81116ba84c716fc

Contents?: true

Size: 507 Bytes

Versions: 6

Compression:

Stored size: 507 Bytes

Contents

require "cases/helper"
require 'models/topic'

module ActiveRecord
  class PredicateBuilderTest < ActiveRecord::TestCase
    def test_registering_new_handlers
      Topic.predicate_builder.register_handler(Regexp, proc do |column, value|
        Arel::Nodes::InfixOperation.new('~', column, Arel.sql(value.source))
      end)

      assert_match %r{["`]topics["`]\.["`]title["`] ~ rails}i, Topic.where(title: /rails/).to_sql
    ensure
      Topic.reset_column_information
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
ibm_db-5.2.0-x86-mingw32 test/cases/relation/predicate_builder_test.rb
ibm_db-5.1.0-x86-mingw32 test/cases/relation/predicate_builder_test.rb
ibm_db-5.0.5-x86-mingw32 test/cases/relation/predicate_builder_test.rb
ibm_db-5.0.4-x86-mingw32 test/cases/relation/predicate_builder_test.rb
ibm_db-5.0.3-x86-mingw32 test/cases/relation/predicate_builder_test.rb
ibm_db-5.0.2-x86-mingw32 test/cases/relation/predicate_builder_test.rb