Sha256: d046c71816c9a583aa3b0865defac17f36c5d61252cf766ad00b2aaf17c47ec7

Contents?: true

Size: 491 Bytes

Versions: 8

Compression:

Stored size: 491 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

8 entries across 8 versions & 1 rubygems

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