Sha256: 89d1ae19bd8524521c1fa1f5e0097c311d24a02d0412a4f1432529007dd301f9

Contents?: true

Size: 435 Bytes

Versions: 10

Compression:

Stored size: 435 Bytes

Contents

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

module ActiveRecord
  class PredicateBuilderTest < ActiveRecord::TestCase
    def test_registering_new_handlers
      PredicateBuilder.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
    end
  end
end

Version data entries

10 entries across 10 versions & 2 rubygems

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