hoodoo 1.11.0 → 1.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -13
 - data/lib/hoodoo/active/active_record/finder.rb +16 -17
 - data/lib/hoodoo/active/active_record/search_helper.rb +118 -29
 - data/lib/hoodoo/active/active_record/support.rb +45 -0
 - data/lib/hoodoo/client/paginated_enumeration.rb +1 -1
 - data/lib/hoodoo/services/middleware/middleware.rb +85 -12
 - data/lib/hoodoo/services/services/interface.rb +66 -8
 - data/lib/hoodoo/version.rb +1 -1
 - data/spec/active/active_record/finder_spec.rb +131 -11
 - data/spec/active/active_record/search_helper_spec.rb +500 -273
 - data/spec/active/active_record/support_spec.rb +22 -0
 - data/spec/client/paginated_enumeration_spec.rb +41 -42
 - data/spec/monkey/patch/newrelic_middleware_analytics_spec.rb +60 -0
 - data/spec/monkey/patch/newrelic_traced_amqp_spec.rb +2 -2
 - data/spec/new_relic/agent/method_tracer.rb +35 -0
 - data/spec/services/middleware/middleware_spec.rb +74 -0
 - data/spec/services/services/interface_spec.rb +26 -0
 - metadata +43 -39
 
| 
         @@ -58,10 +58,20 @@ module Hoodoo; module Services 
     | 
|
| 
       58 
58 
     | 
    
         
             
                  #
         
     | 
| 
       59 
59 
     | 
    
         
             
                  attr_reader :search
         
     | 
| 
       60 
60 
     | 
    
         | 
| 
      
 61 
     | 
    
         
            +
                  # Array of prohibited framework search keys as Strings; empty for none
         
     | 
| 
      
 62 
     | 
    
         
            +
                  # defined.
         
     | 
| 
      
 63 
     | 
    
         
            +
                  #
         
     | 
| 
      
 64 
     | 
    
         
            +
                  attr_reader :do_not_search
         
     | 
| 
      
 65 
     | 
    
         
            +
             
     | 
| 
       61 
66 
     | 
    
         
             
                  # Array of supported filter keys as Strings; empty for none defined.
         
     | 
| 
       62 
67 
     | 
    
         
             
                  #
         
     | 
| 
       63 
68 
     | 
    
         
             
                  attr_reader :filter
         
     | 
| 
       64 
69 
     | 
    
         | 
| 
      
 70 
     | 
    
         
            +
                  # Array of prohibited framewor filter keys as Strings; empty for none
         
     | 
| 
      
 71 
     | 
    
         
            +
                  # defined.
         
     | 
| 
      
 72 
     | 
    
         
            +
                  #
         
     | 
| 
      
 73 
     | 
    
         
            +
                  attr_reader :do_not_filter
         
     | 
| 
      
 74 
     | 
    
         
            +
             
     | 
| 
       65 
75 
     | 
    
         
             
                  # Create an instance with default settings.
         
     | 
| 
       66 
76 
     | 
    
         
             
                  #
         
     | 
| 
       67 
77 
     | 
    
         
             
                  def initialize
         
     | 
| 
         @@ -74,7 +84,9 @@ module Hoodoo; module Services 
     | 
|
| 
       74 
84 
     | 
    
         
             
                    @sort             = { 'created_at' => Set.new( [ 'desc', 'asc' ] ) }
         
     | 
| 
       75 
85 
     | 
    
         
             
                    @default_sort_key = 'created_at'
         
     | 
| 
       76 
86 
     | 
    
         
             
                    @search           = []
         
     | 
| 
      
 87 
     | 
    
         
            +
                    @do_not_search    = []
         
     | 
| 
       77 
88 
     | 
    
         
             
                    @filter           = []
         
     | 
| 
      
 89 
     | 
    
         
            +
                    @do_not_filter    = []
         
     | 
| 
       78 
90 
     | 
    
         
             
                  end
         
     | 
| 
       79 
91 
     | 
    
         | 
| 
       80 
92 
     | 
    
         
             
                  private
         
     | 
| 
         @@ -103,12 +115,24 @@ module Hoodoo; module Services 
     | 
|
| 
       103 
115 
     | 
    
         
             
                    #
         
     | 
| 
       104 
116 
     | 
    
         
             
                    attr_writer :search
         
     | 
| 
       105 
117 
     | 
    
         | 
| 
      
 118 
     | 
    
         
            +
                    # Private writer - see #do_not_search - but there's a special contract
         
     | 
| 
      
 119 
     | 
    
         
            +
                    # with Hoodoo::Services::Interface::ToListDSL which permits it to call
         
     | 
| 
      
 120 
     | 
    
         
            +
                    # here bypassing +private+ via +send()+.
         
     | 
| 
      
 121 
     | 
    
         
            +
                    #
         
     | 
| 
      
 122 
     | 
    
         
            +
                    attr_writer :do_not_search
         
     | 
| 
      
 123 
     | 
    
         
            +
             
     | 
| 
       106 
124 
     | 
    
         
             
                    # Private writer - see #filter - but there's a special contract with
         
     | 
| 
       107 
125 
     | 
    
         
             
                    # Hoodoo::Services::Interface::ToListDSL which permits it to call here
         
     | 
| 
       108 
126 
     | 
    
         
             
                    # bypassing +private+ via +send()+.
         
     | 
| 
       109 
127 
     | 
    
         
             
                    #
         
     | 
| 
       110 
128 
     | 
    
         
             
                    attr_writer :filter
         
     | 
| 
       111 
129 
     | 
    
         | 
| 
      
 130 
     | 
    
         
            +
                    # Private writer - see #do_not_filter - but there's a special contract
         
     | 
| 
      
 131 
     | 
    
         
            +
                    # with Hoodoo::Services::Interface::ToListDSL which permits it to call
         
     | 
| 
      
 132 
     | 
    
         
            +
                    # here bypassing +private+ via +send()+.
         
     | 
| 
      
 133 
     | 
    
         
            +
                    #
         
     | 
| 
      
 134 
     | 
    
         
            +
                    attr_writer :do_not_filter
         
     | 
| 
      
 135 
     | 
    
         
            +
             
     | 
| 
       112 
136 
     | 
    
         
             
                end # 'class ToList'
         
     | 
| 
       113 
137 
     | 
    
         | 
| 
       114 
138 
     | 
    
         
             
                ###########################################################################
         
     | 
| 
         @@ -223,25 +247,59 @@ module Hoodoo; module Services 
     | 
|
| 
       223 
247 
     | 
    
         
             
                  # value escaping and validation, if necessary, is up to the service
         
     | 
| 
       224 
248 
     | 
    
         
             
                  # implementation.
         
     | 
| 
       225 
249 
     | 
    
         
             
                  #
         
     | 
| 
       226 
     | 
    
         
            -
                  # + 
     | 
| 
       227 
     | 
    
         
            -
                  # 
     | 
| 
      
 250 
     | 
    
         
            +
                  # +keys+:: Array of permitted search keys, as symbols or strings.
         
     | 
| 
      
 251 
     | 
    
         
            +
                  #          The order of array entries is arbitrary.
         
     | 
| 
       228 
252 
     | 
    
         
             
                  #
         
     | 
| 
       229 
253 
     | 
    
         
             
                  # Example - allow searches specifying +first_name+ and +last_name+ keys:
         
     | 
| 
       230 
254 
     | 
    
         
             
                  #
         
     | 
| 
       231 
255 
     | 
    
         
             
                  #     search :first_name, :last_name
         
     | 
| 
       232 
256 
     | 
    
         
             
                  #
         
     | 
| 
       233 
     | 
    
         
            -
                  def search( * 
     | 
| 
       234 
     | 
    
         
            -
                    @tl.send( :search=,  
     | 
| 
      
 257 
     | 
    
         
            +
                  def search( *keys )
         
     | 
| 
      
 258 
     | 
    
         
            +
                    @tl.send( :search=, keys.map { | item | item.to_s } )
         
     | 
| 
      
 259 
     | 
    
         
            +
                  end
         
     | 
| 
      
 260 
     | 
    
         
            +
             
     | 
| 
      
 261 
     | 
    
         
            +
                  # Similar to #search, but for default Hoodoo framework exclusions. The
         
     | 
| 
      
 262 
     | 
    
         
            +
                  # Hoodoo::Services::Middleware +FRAMEWORK_QUERY_DATA+ array lists the
         
     | 
| 
      
 263 
     | 
    
         
            +
                  # known framework keys for a given Hoodoo version. An exception is
         
     | 
| 
      
 264 
     | 
    
         
            +
                  # raised if an attempt is made to exclude unknown keys.
         
     | 
| 
      
 265 
     | 
    
         
            +
                  #
         
     | 
| 
      
 266 
     | 
    
         
            +
                  # +keys+:: Array of prohibited framework search keys, as symbols or
         
     | 
| 
      
 267 
     | 
    
         
            +
                  #          strings. The order of array entries is arbitrary.
         
     | 
| 
      
 268 
     | 
    
         
            +
                  #
         
     | 
| 
      
 269 
     | 
    
         
            +
                  def do_not_search( *keys )
         
     | 
| 
      
 270 
     | 
    
         
            +
                    @tl.send( :do_not_search=, keys.map { | item | item.to_s } )
         
     | 
| 
      
 271 
     | 
    
         
            +
             
     | 
| 
      
 272 
     | 
    
         
            +
                    unknown = @tl.do_not_search() - Hoodoo::Services::Middleware::FRAMEWORK_QUERY_DATA.keys
         
     | 
| 
      
 273 
     | 
    
         
            +
             
     | 
| 
      
 274 
     | 
    
         
            +
                    unless unknown.empty?
         
     | 
| 
      
 275 
     | 
    
         
            +
                      raise "Hoodoo::Services::Interface::ToListDSL\#do_not_search was given one or more unknown keys: #{ unknown.join( ', ' ) }"
         
     | 
| 
      
 276 
     | 
    
         
            +
                    end
         
     | 
| 
       235 
277 
     | 
    
         
             
                  end
         
     | 
| 
       236 
278 
     | 
    
         | 
| 
       237 
279 
     | 
    
         
             
                  # As #search, but for filtering.
         
     | 
| 
       238 
280 
     | 
    
         
             
                  #
         
     | 
| 
       239 
     | 
    
         
            -
                  # + 
     | 
| 
       240 
     | 
    
         
            -
                  # 
     | 
| 
      
 281 
     | 
    
         
            +
                  # +keys+:: Array of permitted filter keys, as symbols or strings.
         
     | 
| 
      
 282 
     | 
    
         
            +
                  #          The order of array entries is arbitrary.
         
     | 
| 
       241 
283 
     | 
    
         
             
                  #
         
     | 
| 
       242 
     | 
    
         
            -
                  def filter( * 
     | 
| 
       243 
     | 
    
         
            -
                    @tl.send( :filter=,  
     | 
| 
      
 284 
     | 
    
         
            +
                  def filter( *keys )
         
     | 
| 
      
 285 
     | 
    
         
            +
                    @tl.send( :filter=, keys.map { | item | item.to_s } )
         
     | 
| 
       244 
286 
     | 
    
         
             
                  end
         
     | 
| 
      
 287 
     | 
    
         
            +
             
     | 
| 
      
 288 
     | 
    
         
            +
                  # As #do_not_search, but for default Hoodoo framework exclusions.
         
     | 
| 
      
 289 
     | 
    
         
            +
                  #
         
     | 
| 
      
 290 
     | 
    
         
            +
                  # +keys+:: Array of prohibited framework filter keys, as symbols or
         
     | 
| 
      
 291 
     | 
    
         
            +
                  #          strings. The order of array entries is arbitrary.
         
     | 
| 
      
 292 
     | 
    
         
            +
                  #
         
     | 
| 
      
 293 
     | 
    
         
            +
                  def do_not_filter( *keys )
         
     | 
| 
      
 294 
     | 
    
         
            +
                    @tl.send( :do_not_filter=, keys.map { | item | item.to_s } )
         
     | 
| 
      
 295 
     | 
    
         
            +
             
     | 
| 
      
 296 
     | 
    
         
            +
                    unknown = @tl.do_not_filter() - Hoodoo::Services::Middleware::FRAMEWORK_QUERY_DATA.keys
         
     | 
| 
      
 297 
     | 
    
         
            +
             
     | 
| 
      
 298 
     | 
    
         
            +
                    unless unknown.empty?
         
     | 
| 
      
 299 
     | 
    
         
            +
                      raise "Hoodoo::Services::Interface::ToListDSL\#do_not_filter was given one or more unknown keys: #{ unknown.join( ', ' ) }"
         
     | 
| 
      
 300 
     | 
    
         
            +
                    end
         
     | 
| 
      
 301 
     | 
    
         
            +
                  end
         
     | 
| 
      
 302 
     | 
    
         
            +
             
     | 
| 
       245 
303 
     | 
    
         
             
                end # 'class ToListDSL'
         
     | 
| 
       246 
304 
     | 
    
         | 
| 
       247 
305 
     | 
    
         
             
                ###########################################################################
         
     | 
    
        data/lib/hoodoo/version.rb
    CHANGED
    
    
| 
         @@ -73,31 +73,31 @@ describe Hoodoo::ActiveRecord::Finder do 
     | 
|
| 
       73 
73 
     | 
    
         
             
                  self.table_name = :r_spec_model_finder_tests
         
     | 
| 
       74 
74 
     | 
    
         
             
                  sh              = Hoodoo::ActiveRecord::Finder::SearchHelper
         
     | 
| 
       75 
75 
     | 
    
         | 
| 
       76 
     | 
    
         
            -
                   
     | 
| 
      
 76 
     | 
    
         
            +
                  search_and_filter_map = {
         
     | 
| 
       77 
77 
     | 
    
         
             
                    'mapped_code'     => sh.cs_match( 'code' ),
         
     | 
| 
       78 
78 
     | 
    
         
             
                    :mapped_field_one => sh.ci_match_generic( 'field_one' ),
         
     | 
| 
       79 
79 
     | 
    
         
             
                    :wild_field_one   => sh.ciaw_match_generic( 'field_one '),
         
     | 
| 
       80 
80 
     | 
    
         
             
                    :field_two        => sh.cs_match_csv(),
         
     | 
| 
       81 
     | 
    
         
            -
                    'field_three'     => sh.cs_match_array()
         
     | 
| 
       82 
     | 
    
         
            -
             
     | 
| 
      
 81 
     | 
    
         
            +
                    'field_three'     => sh.cs_match_array(),
         
     | 
| 
      
 82 
     | 
    
         
            +
                    'created_after'   => sh.cs_gte( 'updated_at' )
         
     | 
| 
      
 83 
     | 
    
         
            +
                  }
         
     | 
| 
       83 
84 
     | 
    
         | 
| 
       84 
     | 
    
         
            -
                   
     | 
| 
       85 
     | 
    
         
            -
             
     | 
| 
       86 
     | 
    
         
            -
                    :mapped_field_one => sh.ci_match_postgres( 'field_one' ),
         
     | 
| 
       87 
     | 
    
         
            -
                    :wild_field_one   => sh.ciaw_match_postgres( 'field_one '),
         
     | 
| 
       88 
     | 
    
         
            -
                    :field_two        => sh.cs_match_csv(),
         
     | 
| 
       89 
     | 
    
         
            -
                    'field_three'     => sh.cs_match_array()
         
     | 
| 
       90 
     | 
    
         
            -
                  )
         
     | 
| 
      
 85 
     | 
    
         
            +
                  search_with( search_and_filter_map )
         
     | 
| 
      
 86 
     | 
    
         
            +
                  filter_with( search_and_filter_map )
         
     | 
| 
       91 
87 
     | 
    
         
             
                end
         
     | 
| 
       92 
88 
     | 
    
         
             
              end
         
     | 
| 
       93 
89 
     | 
    
         | 
| 
       94 
90 
     | 
    
         
             
              before :each do
         
     | 
| 
      
 91 
     | 
    
         
            +
                @tn = Time.now.round()
         
     | 
| 
      
 92 
     | 
    
         
            +
             
     | 
| 
       95 
93 
     | 
    
         
             
                @a = RSpecModelFinderTest.new
         
     | 
| 
       96 
94 
     | 
    
         
             
                @a.id = "one"
         
     | 
| 
       97 
95 
     | 
    
         
             
                @a.code = 'A' # Must be set else SQLite fails to find this if you search for "code != 'C'" (!)
         
     | 
| 
       98 
96 
     | 
    
         
             
                @a.field_one = 'group 1'
         
     | 
| 
       99 
97 
     | 
    
         
             
                @a.field_two = 'two a'
         
     | 
| 
       100 
98 
     | 
    
         
             
                @a.field_three = 'three a'
         
     | 
| 
      
 99 
     | 
    
         
            +
                @a.created_at = @tn - 1.year
         
     | 
| 
      
 100 
     | 
    
         
            +
                @a.updated_at = @tn - 1.month
         
     | 
| 
       101 
101 
     | 
    
         
             
                @a.save!
         
     | 
| 
       102 
102 
     | 
    
         
             
                @id = @a.id
         
     | 
| 
       103 
103 
     | 
    
         | 
| 
         @@ -108,6 +108,8 @@ describe Hoodoo::ActiveRecord::Finder do 
     | 
|
| 
       108 
108 
     | 
    
         
             
                @b.field_one = 'group 1'
         
     | 
| 
       109 
109 
     | 
    
         
             
                @b.field_two = 'two b'
         
     | 
| 
       110 
110 
     | 
    
         
             
                @b.field_three = 'three b'
         
     | 
| 
      
 111 
     | 
    
         
            +
                @b.created_at = @tn - 1.month
         
     | 
| 
      
 112 
     | 
    
         
            +
                @b.updated_at = @tn - 1.week
         
     | 
| 
       111 
113 
     | 
    
         
             
                @b.save!
         
     | 
| 
       112 
114 
     | 
    
         
             
                @uuid = @b.uuid
         
     | 
| 
       113 
115 
     | 
    
         | 
| 
         @@ -117,6 +119,8 @@ describe Hoodoo::ActiveRecord::Finder do 
     | 
|
| 
       117 
119 
     | 
    
         
             
                @c.field_one = 'group 2'
         
     | 
| 
       118 
120 
     | 
    
         
             
                @c.field_two = 'two c'
         
     | 
| 
       119 
121 
     | 
    
         
             
                @c.field_three = 'three c'
         
     | 
| 
      
 122 
     | 
    
         
            +
                @c.created_at = @tn
         
     | 
| 
      
 123 
     | 
    
         
            +
                @c.updated_at = @tn + 1.day
         
     | 
| 
       120 
124 
     | 
    
         
             
                @c.save!
         
     | 
| 
       121 
125 
     | 
    
         
             
                @code = @c.code
         
     | 
| 
       122 
126 
     | 
    
         | 
| 
         @@ -610,6 +614,27 @@ describe Hoodoo::ActiveRecord::Finder do 
     | 
|
| 
       610 
614 
     | 
    
         | 
| 
       611 
615 
     | 
    
         
             
                  finder = RSpecModelFinderTest.list( @list_params )
         
     | 
| 
       612 
616 
     | 
    
         
             
                  expect( finder ).to eq([@c])
         
     | 
| 
      
 617 
     | 
    
         
            +
             
     | 
| 
      
 618 
     | 
    
         
            +
                  @list_params.search_data = {
         
     | 
| 
      
 619 
     | 
    
         
            +
                    'created_after' => @tn - 1.month
         
     | 
| 
      
 620 
     | 
    
         
            +
                  }
         
     | 
| 
      
 621 
     | 
    
         
            +
             
     | 
| 
      
 622 
     | 
    
         
            +
                  finder = RSpecModelFinderTest.list( @list_params )
         
     | 
| 
      
 623 
     | 
    
         
            +
                  expect( finder ).to eq([@c])
         
     | 
| 
      
 624 
     | 
    
         
            +
             
     | 
| 
      
 625 
     | 
    
         
            +
                  @list_params.search_data = {
         
     | 
| 
      
 626 
     | 
    
         
            +
                    'created_before' => @tn - 1.month
         
     | 
| 
      
 627 
     | 
    
         
            +
                  }
         
     | 
| 
      
 628 
     | 
    
         
            +
             
     | 
| 
      
 629 
     | 
    
         
            +
                  finder = RSpecModelFinderTest.list( @list_params )
         
     | 
| 
      
 630 
     | 
    
         
            +
                  expect( finder ).to eq([@a])
         
     | 
| 
      
 631 
     | 
    
         
            +
             
     | 
| 
      
 632 
     | 
    
         
            +
                  @list_params.search_data = {
         
     | 
| 
      
 633 
     | 
    
         
            +
                    'created_before' => @tn - 1.month + 1.day
         
     | 
| 
      
 634 
     | 
    
         
            +
                  }
         
     | 
| 
      
 635 
     | 
    
         
            +
             
     | 
| 
      
 636 
     | 
    
         
            +
                  finder = RSpecModelFinderTest.list( @list_params )
         
     | 
| 
      
 637 
     | 
    
         
            +
                  expect( finder ).to eq([@b, @a])
         
     | 
| 
       613 
638 
     | 
    
         
             
                end
         
     | 
| 
       614 
639 
     | 
    
         | 
| 
       615 
640 
     | 
    
         
             
                it 'searches with chain' do
         
     | 
| 
         @@ -650,6 +675,27 @@ describe Hoodoo::ActiveRecord::Finder do 
     | 
|
| 
       650 
675 
     | 
    
         | 
| 
       651 
676 
     | 
    
         
             
                  finder = constraint.list( @list_params )
         
     | 
| 
       652 
677 
     | 
    
         
             
                  expect( finder ).to eq([])
         
     | 
| 
      
 678 
     | 
    
         
            +
             
     | 
| 
      
 679 
     | 
    
         
            +
                  @list_params.search_data = {
         
     | 
| 
      
 680 
     | 
    
         
            +
                    'created_after' => @tn - 1.month
         
     | 
| 
      
 681 
     | 
    
         
            +
                  }
         
     | 
| 
      
 682 
     | 
    
         
            +
             
     | 
| 
      
 683 
     | 
    
         
            +
                  finder = constraint.list( @list_params )
         
     | 
| 
      
 684 
     | 
    
         
            +
                  expect( finder ).to eq([])
         
     | 
| 
      
 685 
     | 
    
         
            +
             
     | 
| 
      
 686 
     | 
    
         
            +
                  @list_params.search_data = {
         
     | 
| 
      
 687 
     | 
    
         
            +
                    'created_before' => @tn - 1.month
         
     | 
| 
      
 688 
     | 
    
         
            +
                  }
         
     | 
| 
      
 689 
     | 
    
         
            +
             
     | 
| 
      
 690 
     | 
    
         
            +
                  finder = constraint.list( @list_params )
         
     | 
| 
      
 691 
     | 
    
         
            +
                  expect( finder ).to eq([@a])
         
     | 
| 
      
 692 
     | 
    
         
            +
             
     | 
| 
      
 693 
     | 
    
         
            +
                  @list_params.search_data = {
         
     | 
| 
      
 694 
     | 
    
         
            +
                    'created_before' => @tn - 1.month + 1.day
         
     | 
| 
      
 695 
     | 
    
         
            +
                  }
         
     | 
| 
      
 696 
     | 
    
         
            +
             
     | 
| 
      
 697 
     | 
    
         
            +
                  finder = constraint.list( @list_params )
         
     | 
| 
      
 698 
     | 
    
         
            +
                  expect( finder ).to eq([@b, @a])
         
     | 
| 
       653 
699 
     | 
    
         
             
                end
         
     | 
| 
       654 
700 
     | 
    
         
             
              end
         
     | 
| 
       655 
701 
     | 
    
         | 
| 
         @@ -707,6 +753,22 @@ describe Hoodoo::ActiveRecord::Finder do 
     | 
|
| 
       707 
753 
     | 
    
         
             
                  finder = RSpecModelFinderTestWithHelpers.list( @list_params )
         
     | 
| 
       708 
754 
     | 
    
         
             
                  expect( finder ).to eq( [ @c_wh, @b_wh ] )
         
     | 
| 
       709 
755 
     | 
    
         
             
                end
         
     | 
| 
      
 756 
     | 
    
         
            +
             
     | 
| 
      
 757 
     | 
    
         
            +
                it 'finds with framework override' do
         
     | 
| 
      
 758 
     | 
    
         
            +
                  @list_params.search_data = {
         
     | 
| 
      
 759 
     | 
    
         
            +
                    'created_after' => @tn - 1.week
         
     | 
| 
      
 760 
     | 
    
         
            +
                  }
         
     | 
| 
      
 761 
     | 
    
         
            +
             
     | 
| 
      
 762 
     | 
    
         
            +
                  finder = RSpecModelFinderTestWithHelpers.list( @list_params )
         
     | 
| 
      
 763 
     | 
    
         
            +
                  expect( finder ).to eq( [ @c_wh, @b_wh ] )
         
     | 
| 
      
 764 
     | 
    
         
            +
             
     | 
| 
      
 765 
     | 
    
         
            +
                  @list_params.search_data = {
         
     | 
| 
      
 766 
     | 
    
         
            +
                    'created_after' => @tn + 1.day
         
     | 
| 
      
 767 
     | 
    
         
            +
                  }
         
     | 
| 
      
 768 
     | 
    
         
            +
             
     | 
| 
      
 769 
     | 
    
         
            +
                  finder = RSpecModelFinderTestWithHelpers.list( @list_params )
         
     | 
| 
      
 770 
     | 
    
         
            +
                  expect( finder ).to eq( [ @c_wh ] )
         
     | 
| 
      
 771 
     | 
    
         
            +
                end
         
     | 
| 
       710 
772 
     | 
    
         
             
              end
         
     | 
| 
       711 
773 
     | 
    
         | 
| 
       712 
774 
     | 
    
         
             
              # ==========================================================================
         
     | 
| 
         @@ -748,6 +810,27 @@ describe Hoodoo::ActiveRecord::Finder do 
     | 
|
| 
       748 
810 
     | 
    
         | 
| 
       749 
811 
     | 
    
         
             
                  finder = RSpecModelFinderTest.list( @list_params )
         
     | 
| 
       750 
812 
     | 
    
         
             
                  expect( finder ).to eq([@b])
         
     | 
| 
      
 813 
     | 
    
         
            +
             
     | 
| 
      
 814 
     | 
    
         
            +
                  @list_params.filter_data = {
         
     | 
| 
      
 815 
     | 
    
         
            +
                    'created_after' => @tn - 1.month
         
     | 
| 
      
 816 
     | 
    
         
            +
                  }
         
     | 
| 
      
 817 
     | 
    
         
            +
             
     | 
| 
      
 818 
     | 
    
         
            +
                  finder = RSpecModelFinderTest.list( @list_params )
         
     | 
| 
      
 819 
     | 
    
         
            +
                  expect( finder ).to eq([@b, @a])
         
     | 
| 
      
 820 
     | 
    
         
            +
             
     | 
| 
      
 821 
     | 
    
         
            +
                  @list_params.filter_data = {
         
     | 
| 
      
 822 
     | 
    
         
            +
                    'created_before' => @tn - 1.month
         
     | 
| 
      
 823 
     | 
    
         
            +
                  }
         
     | 
| 
      
 824 
     | 
    
         
            +
             
     | 
| 
      
 825 
     | 
    
         
            +
                  finder = RSpecModelFinderTest.list( @list_params )
         
     | 
| 
      
 826 
     | 
    
         
            +
                  expect( finder ).to eq([@c, @b])
         
     | 
| 
      
 827 
     | 
    
         
            +
             
     | 
| 
      
 828 
     | 
    
         
            +
                  @list_params.filter_data = {
         
     | 
| 
      
 829 
     | 
    
         
            +
                    'created_before' => @tn - 1.month + 1.day
         
     | 
| 
      
 830 
     | 
    
         
            +
                  }
         
     | 
| 
      
 831 
     | 
    
         
            +
             
     | 
| 
      
 832 
     | 
    
         
            +
                  finder = RSpecModelFinderTest.list( @list_params )
         
     | 
| 
      
 833 
     | 
    
         
            +
                  expect( finder ).to eq([@c])
         
     | 
| 
       751 
834 
     | 
    
         
             
                end
         
     | 
| 
       752 
835 
     | 
    
         | 
| 
       753 
836 
     | 
    
         
             
                it 'filters with chain' do
         
     | 
| 
         @@ -792,6 +875,27 @@ describe Hoodoo::ActiveRecord::Finder do 
     | 
|
| 
       792 
875 
     | 
    
         | 
| 
       793 
876 
     | 
    
         
             
                  finder = constraint.list( @list_params )
         
     | 
| 
       794 
877 
     | 
    
         
             
                  expect( finder ).to eq([])
         
     | 
| 
      
 878 
     | 
    
         
            +
             
     | 
| 
      
 879 
     | 
    
         
            +
                  @list_params.filter_data = {
         
     | 
| 
      
 880 
     | 
    
         
            +
                    'created_after' => @tn - 1.month
         
     | 
| 
      
 881 
     | 
    
         
            +
                  }
         
     | 
| 
      
 882 
     | 
    
         
            +
             
     | 
| 
      
 883 
     | 
    
         
            +
                  finder = constraint.list( @list_params )
         
     | 
| 
      
 884 
     | 
    
         
            +
                  expect( finder ).to eq([])
         
     | 
| 
      
 885 
     | 
    
         
            +
             
     | 
| 
      
 886 
     | 
    
         
            +
                  @list_params.filter_data = {
         
     | 
| 
      
 887 
     | 
    
         
            +
                    'created_before' => @tn - 1.month
         
     | 
| 
      
 888 
     | 
    
         
            +
                  }
         
     | 
| 
      
 889 
     | 
    
         
            +
             
     | 
| 
      
 890 
     | 
    
         
            +
                  finder = constraint.list( @list_params )
         
     | 
| 
      
 891 
     | 
    
         
            +
                  expect( finder ).to eq([@c])
         
     | 
| 
      
 892 
     | 
    
         
            +
             
     | 
| 
      
 893 
     | 
    
         
            +
                  @list_params.filter_data = {
         
     | 
| 
      
 894 
     | 
    
         
            +
                    'created_before' => @tn - 1.month + 1.day
         
     | 
| 
      
 895 
     | 
    
         
            +
                  }
         
     | 
| 
      
 896 
     | 
    
         
            +
             
     | 
| 
      
 897 
     | 
    
         
            +
                  finder = constraint.list( @list_params )
         
     | 
| 
      
 898 
     | 
    
         
            +
                  expect( finder ).to eq([@c])
         
     | 
| 
       795 
899 
     | 
    
         
             
                end
         
     | 
| 
       796 
900 
     | 
    
         
             
              end
         
     | 
| 
       797 
901 
     | 
    
         | 
| 
         @@ -837,7 +941,6 @@ describe Hoodoo::ActiveRecord::Finder do 
     | 
|
| 
       837 
941 
     | 
    
         
             
                  expect( finder ).to eq( [ @c_wh, @b_wh, @a_wh ] )
         
     | 
| 
       838 
942 
     | 
    
         
             
                end
         
     | 
| 
       839 
943 
     | 
    
         | 
| 
       840 
     | 
    
         
            -
             
     | 
| 
       841 
944 
     | 
    
         
             
                it 'filters by comma-separated list' do
         
     | 
| 
       842 
945 
     | 
    
         
             
                  @list_params.filter_data = {
         
     | 
| 
       843 
946 
     | 
    
         
             
                    'field_two' => 'two a,something else,two c,more'
         
     | 
| 
         @@ -855,6 +958,22 @@ describe Hoodoo::ActiveRecord::Finder do 
     | 
|
| 
       855 
958 
     | 
    
         
             
                  finder = RSpecModelFinderTestWithHelpers.list( @list_params )
         
     | 
| 
       856 
959 
     | 
    
         
             
                  expect( finder ).to eq( [ @a_wh ] )
         
     | 
| 
       857 
960 
     | 
    
         
             
                end
         
     | 
| 
      
 961 
     | 
    
         
            +
             
     | 
| 
      
 962 
     | 
    
         
            +
                it 'filters with framework override' do
         
     | 
| 
      
 963 
     | 
    
         
            +
                  @list_params.filter_data = {
         
     | 
| 
      
 964 
     | 
    
         
            +
                    'created_after' => @tn - 1.week
         
     | 
| 
      
 965 
     | 
    
         
            +
                  }
         
     | 
| 
      
 966 
     | 
    
         
            +
             
     | 
| 
      
 967 
     | 
    
         
            +
                  finder = RSpecModelFinderTestWithHelpers.list( @list_params )
         
     | 
| 
      
 968 
     | 
    
         
            +
                  expect( finder ).to eq( [ @a_wh ] )
         
     | 
| 
      
 969 
     | 
    
         
            +
             
     | 
| 
      
 970 
     | 
    
         
            +
                  @list_params.filter_data = {
         
     | 
| 
      
 971 
     | 
    
         
            +
                    'created_after' => @tn + 1.day
         
     | 
| 
      
 972 
     | 
    
         
            +
                  }
         
     | 
| 
      
 973 
     | 
    
         
            +
             
     | 
| 
      
 974 
     | 
    
         
            +
                  finder = RSpecModelFinderTestWithHelpers.list( @list_params )
         
     | 
| 
      
 975 
     | 
    
         
            +
                  expect( finder ).to eq( [ @b_wh, @a_wh ] )
         
     | 
| 
      
 976 
     | 
    
         
            +
                end
         
     | 
| 
       858 
977 
     | 
    
         
             
              end
         
     | 
| 
       859 
978 
     | 
    
         | 
| 
       860 
979 
     | 
    
         
             
              # ==========================================================================
         
     | 
| 
         @@ -866,6 +985,7 @@ describe Hoodoo::ActiveRecord::Finder do 
     | 
|
| 
       866 
985 
     | 
    
         
             
                  @scoped_1.uuid = 'uuid 1'
         
     | 
| 
       867 
986 
     | 
    
         
             
                  @scoped_1.code = 'code 1'
         
     | 
| 
       868 
987 
     | 
    
         
             
                  @scoped_1.field_one = 'scoped 1'
         
     | 
| 
      
 988 
     | 
    
         
            +
                  @scoped_1.created_at = @tn - 1.year
         
     | 
| 
       869 
989 
     | 
    
         
             
                  @scoped_1.save!
         
     | 
| 
       870 
990 
     | 
    
         | 
| 
       871 
991 
     | 
    
         
             
                  @scoped_2 = RSpecModelFinderTest.new
         
     | 
| 
         @@ -27,17 +27,6 @@ describe Hoodoo::ActiveRecord::Finder::SearchHelper do 
     | 
|
| 
       27 
27 
     | 
    
         
             
                end
         
     | 
| 
       28 
28 
     | 
    
         
             
              end
         
     | 
| 
       29 
29 
     | 
    
         | 
| 
       30 
     | 
    
         
            -
              before :each do
         
     | 
| 
       31 
     | 
    
         
            -
                @f1 = RSpecModelSearchHelperTest.create
         
     | 
| 
       32 
     | 
    
         
            -
                @f2 = RSpecModelSearchHelperTest.create( :field => 'hello' )
         
     | 
| 
       33 
     | 
    
         
            -
                @f3 = RSpecModelSearchHelperTest.create( :field => 'hello' )
         
     | 
| 
       34 
     | 
    
         
            -
                @f4 = RSpecModelSearchHelperTest.create( :field => 'HELLO' )
         
     | 
| 
       35 
     | 
    
         
            -
                @f5 = RSpecModelSearchHelperTest.create
         
     | 
| 
       36 
     | 
    
         
            -
                @f6 = RSpecModelSearchHelperTest.create( :field => 'world' )
         
     | 
| 
       37 
     | 
    
         
            -
                @f7 = RSpecModelSearchHelperTest.create( :field => 'world' )
         
     | 
| 
       38 
     | 
    
         
            -
                @f8 = RSpecModelSearchHelperTest.create( :field => 'WORLD' )
         
     | 
| 
       39 
     | 
    
         
            -
              end
         
     | 
| 
       40 
     | 
    
         
            -
             
     | 
| 
       41 
30 
     | 
    
         
             
              def find( clause )
         
     | 
| 
       42 
31 
     | 
    
         
             
                RSpecModelSearchHelperTest.where( *clause ).all
         
     | 
| 
       43 
32 
     | 
    
         
             
              end
         
     | 
| 
         @@ -46,387 +35,625 @@ describe Hoodoo::ActiveRecord::Finder::SearchHelper do 
     | 
|
| 
       46 
35 
     | 
    
         
             
                RSpecModelSearchHelperTest.where.not( *clause ).all
         
     | 
| 
       47 
36 
     | 
    
         
             
              end
         
     | 
| 
       48 
37 
     | 
    
         | 
| 
      
 38 
     | 
    
         
            +
              #############################################################################
         
     | 
| 
      
 39 
     | 
    
         
            +
              # Although the queries in this section can match things other than strings
         
     | 
| 
      
 40 
     | 
    
         
            +
              # in some cases, they're aimed at string comparison most of the time.
         
     | 
| 
       49 
41 
     | 
    
         
             
              #############################################################################
         
     | 
| 
       50 
42 
     | 
    
         | 
| 
       51 
     | 
    
         
            -
              context ' 
     | 
| 
       52 
     | 
    
         
            -
                 
     | 
| 
       53 
     | 
    
         
            -
                   
     | 
| 
       54 
     | 
    
         
            -
                   
     | 
| 
      
 43 
     | 
    
         
            +
              context 'equality' do
         
     | 
| 
      
 44 
     | 
    
         
            +
                before :each do
         
     | 
| 
      
 45 
     | 
    
         
            +
                  @f1 = RSpecModelSearchHelperTest.create
         
     | 
| 
      
 46 
     | 
    
         
            +
                  @f2 = RSpecModelSearchHelperTest.create( :field => 'hello' )
         
     | 
| 
      
 47 
     | 
    
         
            +
                  @f3 = RSpecModelSearchHelperTest.create( :field => 'hello' )
         
     | 
| 
      
 48 
     | 
    
         
            +
                  @f4 = RSpecModelSearchHelperTest.create( :field => 'HELLO' )
         
     | 
| 
      
 49 
     | 
    
         
            +
                  @f5 = RSpecModelSearchHelperTest.create
         
     | 
| 
      
 50 
     | 
    
         
            +
                  @f6 = RSpecModelSearchHelperTest.create( :field => 'world' )
         
     | 
| 
      
 51 
     | 
    
         
            +
                  @f7 = RSpecModelSearchHelperTest.create( :field => 'world' )
         
     | 
| 
      
 52 
     | 
    
         
            +
                  @f8 = RSpecModelSearchHelperTest.create( :field => 'WORLD' )
         
     | 
| 
       55 
53 
     | 
    
         
             
                end
         
     | 
| 
       56 
54 
     | 
    
         | 
| 
       57 
     | 
    
         
            -
                 
     | 
| 
       58 
     | 
    
         
            -
                  result = described_class.cs_match( :bar )
         
     | 
| 
       59 
     | 
    
         
            -
                  expect( result.call( 'a', 'b' ) ).to eq( [ 'bar = ? AND bar IS NOT NULL', 'b' ] )
         
     | 
| 
       60 
     | 
    
         
            -
                end
         
     | 
| 
      
 55 
     | 
    
         
            +
                ###########################################################################
         
     | 
| 
       61 
56 
     | 
    
         | 
| 
       62 
     | 
    
         
            -
                 
     | 
| 
       63 
     | 
    
         
            -
                   
     | 
| 
       64 
     | 
    
         
            -
             
     | 
| 
      
 57 
     | 
    
         
            +
                context '#cs_match' do
         
     | 
| 
      
 58 
     | 
    
         
            +
                  it 'generates expected no-input-parameter output' do
         
     | 
| 
      
 59 
     | 
    
         
            +
                    result = described_class.cs_match
         
     | 
| 
      
 60 
     | 
    
         
            +
                    expect( result.call( 'a', 'b' ) ).to eq( [ 'a = ? AND a IS NOT NULL', 'b' ] )
         
     | 
| 
      
 61 
     | 
    
         
            +
                  end
         
     | 
| 
       65 
62 
     | 
    
         | 
| 
       66 
     | 
    
         
            -
                   
     | 
| 
       67 
     | 
    
         
            -
             
     | 
| 
      
 63 
     | 
    
         
            +
                  it 'generates expected one-input-parameter output' do
         
     | 
| 
      
 64 
     | 
    
         
            +
                    result = described_class.cs_match( :bar )
         
     | 
| 
      
 65 
     | 
    
         
            +
                    expect( result.call( 'a', 'b' ) ).to eq( [ 'bar = ? AND bar IS NOT NULL', 'b' ] )
         
     | 
| 
      
 66 
     | 
    
         
            +
                  end
         
     | 
| 
       68 
67 
     | 
    
         | 
| 
       69 
     | 
    
         
            -
                   
     | 
| 
       70 
     | 
    
         
            -
             
     | 
| 
      
 68 
     | 
    
         
            +
                  it 'finds expected things' do
         
     | 
| 
      
 69 
     | 
    
         
            +
                    result = find( described_class.cs_match.call( 'field', 'hello' ) )
         
     | 
| 
      
 70 
     | 
    
         
            +
                    expect( result ).to match_array( [ @f2, @f3 ] )
         
     | 
| 
       71 
71 
     | 
    
         | 
| 
       72 
     | 
    
         
            -
             
     | 
| 
       73 
     | 
    
         
            -
             
     | 
| 
      
 72 
     | 
    
         
            +
                    result = find( described_class.cs_match.call( 'field', 'HELLO' ) )
         
     | 
| 
      
 73 
     | 
    
         
            +
                    expect( result ).to match_array( [ @f4 ] )
         
     | 
| 
       74 
74 
     | 
    
         | 
| 
       75 
     | 
    
         
            -
             
     | 
| 
       76 
     | 
    
         
            -
             
     | 
| 
       77 
     | 
    
         
            -
                end
         
     | 
| 
      
 75 
     | 
    
         
            +
                    result = find( described_class.cs_match.call( 'field', 'hell' ) )
         
     | 
| 
      
 76 
     | 
    
         
            +
                    expect( result ).to match_array( [] )
         
     | 
| 
       78 
77 
     | 
    
         | 
| 
       79 
     | 
    
         
            -
             
     | 
| 
       80 
     | 
    
         
            -
             
     | 
| 
       81 
     | 
    
         
            -
                  expect( result ).to match_array( [ @f1,           @f4, @f5, @f6, @f7, @f8 ] )
         
     | 
| 
      
 78 
     | 
    
         
            +
                    result = find( described_class.cs_match.call( 'field', 'llo' ) )
         
     | 
| 
      
 79 
     | 
    
         
            +
                    expect( result ).to match_array( [] )
         
     | 
| 
       82 
80 
     | 
    
         | 
| 
       83 
     | 
    
         
            -
             
     | 
| 
       84 
     | 
    
         
            -
             
     | 
| 
      
 81 
     | 
    
         
            +
                    result = find( described_class.cs_match.call( 'field', 'heLLo' ) )
         
     | 
| 
      
 82 
     | 
    
         
            +
                    expect( result ).to match_array( [] )
         
     | 
| 
      
 83 
     | 
    
         
            +
                  end
         
     | 
| 
       85 
84 
     | 
    
         | 
| 
       86 
     | 
    
         
            -
                   
     | 
| 
       87 
     | 
    
         
            -
             
     | 
| 
      
 85 
     | 
    
         
            +
                  it 'finds expected things negated' do
         
     | 
| 
      
 86 
     | 
    
         
            +
                    result = find_not( described_class.cs_match.call( 'field', 'hello' ) )
         
     | 
| 
      
 87 
     | 
    
         
            +
                    expect( result ).to match_array( [ @f1,           @f4, @f5, @f6, @f7, @f8 ] )
         
     | 
| 
       88 
88 
     | 
    
         | 
| 
       89 
     | 
    
         
            -
             
     | 
| 
       90 
     | 
    
         
            -
             
     | 
| 
      
 89 
     | 
    
         
            +
                    result = find_not( described_class.cs_match.call( 'field', 'HELLO' ) )
         
     | 
| 
      
 90 
     | 
    
         
            +
                    expect( result ).to match_array( [ @f1, @f2, @f3,      @f5, @f6, @f7, @f8  ] )
         
     | 
| 
       91 
91 
     | 
    
         | 
| 
       92 
     | 
    
         
            -
             
     | 
| 
       93 
     | 
    
         
            -
             
     | 
| 
       94 
     | 
    
         
            -
                end
         
     | 
| 
       95 
     | 
    
         
            -
              end
         
     | 
| 
      
 92 
     | 
    
         
            +
                    result = find_not( described_class.cs_match.call( 'field', 'hell' ) )
         
     | 
| 
      
 93 
     | 
    
         
            +
                    expect( result ).to match_array( [ @f1, @f2, @f3, @f4, @f5, @f6, @f7, @f8 ] )
         
     | 
| 
       96 
94 
     | 
    
         | 
| 
       97 
     | 
    
         
            -
             
     | 
| 
      
 95 
     | 
    
         
            +
                    result = find_not( described_class.cs_match.call( 'field', 'llo' ) )
         
     | 
| 
      
 96 
     | 
    
         
            +
                    expect( result ).to match_array( [ @f1, @f2, @f3, @f4, @f5, @f6, @f7, @f8 ] )
         
     | 
| 
       98 
97 
     | 
    
         | 
| 
       99 
     | 
    
         
            -
             
     | 
| 
       100 
     | 
    
         
            -
             
     | 
| 
       101 
     | 
    
         
            -
                   
     | 
| 
       102 
     | 
    
         
            -
                  expect( result.call( 'a', 'b,c,d' ) ).to eq( [ 'a IN (?) AND a IS NOT NULL', [ 'b', 'c', 'd' ] ] )
         
     | 
| 
      
 98 
     | 
    
         
            +
                    result = find_not( described_class.cs_match.call( 'field', 'heLLo' ) )
         
     | 
| 
      
 99 
     | 
    
         
            +
                    expect( result ).to match_array( [ @f1, @f2, @f3, @f4, @f5, @f6, @f7, @f8 ] )
         
     | 
| 
      
 100 
     | 
    
         
            +
                  end
         
     | 
| 
       103 
101 
     | 
    
         
             
                end
         
     | 
| 
       104 
102 
     | 
    
         | 
| 
       105 
     | 
    
         
            -
                 
     | 
| 
       106 
     | 
    
         
            -
                  result = described_class.cs_match_csv( :bar )
         
     | 
| 
       107 
     | 
    
         
            -
                  expect( result.call( 'a', 'b,c,d' ) ).to eq( [ 'bar IN (?) AND bar IS NOT NULL', [ 'b', 'c', 'd' ] ] )
         
     | 
| 
       108 
     | 
    
         
            -
                end
         
     | 
| 
      
 103 
     | 
    
         
            +
                ###########################################################################
         
     | 
| 
       109 
104 
     | 
    
         | 
| 
       110 
     | 
    
         
            -
                 
     | 
| 
       111 
     | 
    
         
            -
                   
     | 
| 
       112 
     | 
    
         
            -
             
     | 
| 
      
 105 
     | 
    
         
            +
                context '#cs_match_csv' do
         
     | 
| 
      
 106 
     | 
    
         
            +
                  it 'generates expected no-input-parameter output' do
         
     | 
| 
      
 107 
     | 
    
         
            +
                    result = described_class.cs_match_csv()
         
     | 
| 
      
 108 
     | 
    
         
            +
                    expect( result.call( 'a', 'b,c,d' ) ).to eq( [ 'a IN (?) AND a IS NOT NULL', [ 'b', 'c', 'd' ] ] )
         
     | 
| 
      
 109 
     | 
    
         
            +
                  end
         
     | 
| 
       113 
110 
     | 
    
         | 
| 
       114 
     | 
    
         
            -
                   
     | 
| 
       115 
     | 
    
         
            -
             
     | 
| 
      
 111 
     | 
    
         
            +
                  it 'generates expected one-input-parameter output' do
         
     | 
| 
      
 112 
     | 
    
         
            +
                    result = described_class.cs_match_csv( :bar )
         
     | 
| 
      
 113 
     | 
    
         
            +
                    expect( result.call( 'a', 'b,c,d' ) ).to eq( [ 'bar IN (?) AND bar IS NOT NULL', [ 'b', 'c', 'd' ] ] )
         
     | 
| 
      
 114 
     | 
    
         
            +
                  end
         
     | 
| 
       116 
115 
     | 
    
         | 
| 
       117 
     | 
    
         
            -
                   
     | 
| 
       118 
     | 
    
         
            -
             
     | 
| 
      
 116 
     | 
    
         
            +
                  it 'finds expected things' do
         
     | 
| 
      
 117 
     | 
    
         
            +
                    result = find( described_class.cs_match_csv.call( 'field', 'hello,world' ) )
         
     | 
| 
      
 118 
     | 
    
         
            +
                    expect( result ).to match_array( [ @f2, @f3, @f6, @f7 ] )
         
     | 
| 
       119 
119 
     | 
    
         | 
| 
       120 
     | 
    
         
            -
             
     | 
| 
       121 
     | 
    
         
            -
             
     | 
| 
      
 120 
     | 
    
         
            +
                    result = find( described_class.cs_match_csv.call( 'field', 'HELLO,WORLD' ) )
         
     | 
| 
      
 121 
     | 
    
         
            +
                    expect( result ).to match_array( [ @f4, @f8 ] )
         
     | 
| 
       122 
122 
     | 
    
         | 
| 
       123 
     | 
    
         
            -
             
     | 
| 
       124 
     | 
    
         
            -
             
     | 
| 
       125 
     | 
    
         
            -
                end
         
     | 
| 
      
 123 
     | 
    
         
            +
                    result = find( described_class.cs_match_csv.call( 'field', 'hell,worl' ) )
         
     | 
| 
      
 124 
     | 
    
         
            +
                    expect( result ).to match_array( [] )
         
     | 
| 
       126 
125 
     | 
    
         | 
| 
       127 
     | 
    
         
            -
             
     | 
| 
       128 
     | 
    
         
            -
             
     | 
| 
       129 
     | 
    
         
            -
                  expect( result ).to match_array( [ @f1,           @f4, @f5,          @f8 ] )
         
     | 
| 
      
 126 
     | 
    
         
            +
                    result = find( described_class.cs_match_csv.call( 'field', 'llo,ld' ) )
         
     | 
| 
      
 127 
     | 
    
         
            +
                    expect( result ).to match_array( [] )
         
     | 
| 
       130 
128 
     | 
    
         | 
| 
       131 
     | 
    
         
            -
             
     | 
| 
       132 
     | 
    
         
            -
             
     | 
| 
      
 129 
     | 
    
         
            +
                    result = find( described_class.cs_match_csv.call( 'field', 'heLLo,WORld' ) )
         
     | 
| 
      
 130 
     | 
    
         
            +
                    expect( result ).to match_array( [] )
         
     | 
| 
      
 131 
     | 
    
         
            +
                  end
         
     | 
| 
       133 
132 
     | 
    
         | 
| 
       134 
     | 
    
         
            -
                   
     | 
| 
       135 
     | 
    
         
            -
             
     | 
| 
      
 133 
     | 
    
         
            +
                  it 'finds expected things negated' do
         
     | 
| 
      
 134 
     | 
    
         
            +
                    result = find_not( described_class.cs_match_csv.call( 'field', 'hello,world' ) )
         
     | 
| 
      
 135 
     | 
    
         
            +
                    expect( result ).to match_array( [ @f1,           @f4, @f5,          @f8 ] )
         
     | 
| 
       136 
136 
     | 
    
         | 
| 
       137 
     | 
    
         
            -
             
     | 
| 
       138 
     | 
    
         
            -
             
     | 
| 
      
 137 
     | 
    
         
            +
                    result = find_not( described_class.cs_match_csv.call( 'field', 'HELLO,WORLD' ) )
         
     | 
| 
      
 138 
     | 
    
         
            +
                    expect( result ).to match_array( [ @f1, @f2, @f3,      @f5, @f6, @f7      ] )
         
     | 
| 
       139 
139 
     | 
    
         | 
| 
       140 
     | 
    
         
            -
             
     | 
| 
       141 
     | 
    
         
            -
             
     | 
| 
       142 
     | 
    
         
            -
                end
         
     | 
| 
       143 
     | 
    
         
            -
              end
         
     | 
| 
      
 140 
     | 
    
         
            +
                    result = find_not( described_class.cs_match_csv.call( 'field', 'hell,worl' ) )
         
     | 
| 
      
 141 
     | 
    
         
            +
                    expect( result ).to match_array( [ @f1, @f2, @f3, @f4, @f5, @f6, @f7, @f8 ] )
         
     | 
| 
       144 
142 
     | 
    
         | 
| 
       145 
     | 
    
         
            -
             
     | 
| 
      
 143 
     | 
    
         
            +
                    result = find_not( described_class.cs_match_csv.call( 'field', 'llo,ld' ) )
         
     | 
| 
      
 144 
     | 
    
         
            +
                    expect( result ).to match_array( [ @f1, @f2, @f3, @f4, @f5, @f6, @f7, @f8 ] )
         
     | 
| 
       146 
145 
     | 
    
         | 
| 
       147 
     | 
    
         
            -
             
     | 
| 
       148 
     | 
    
         
            -
             
     | 
| 
       149 
     | 
    
         
            -
                   
     | 
| 
       150 
     | 
    
         
            -
                  expect( result.call( 'a', [ 'b', 'c', 'd' ] ) ).to eq( [ 'a IN (?) AND a IS NOT NULL', [ 'b', 'c', 'd' ] ] )
         
     | 
| 
      
 146 
     | 
    
         
            +
                    result = find_not( described_class.cs_match_csv.call( 'field', 'heLLo,WORld' ) )
         
     | 
| 
      
 147 
     | 
    
         
            +
                    expect( result ).to match_array( [ @f1, @f2, @f3, @f4, @f5, @f6, @f7, @f8 ] )
         
     | 
| 
      
 148 
     | 
    
         
            +
                  end
         
     | 
| 
       151 
149 
     | 
    
         
             
                end
         
     | 
| 
       152 
150 
     | 
    
         | 
| 
       153 
     | 
    
         
            -
                 
     | 
| 
       154 
     | 
    
         
            -
                  result = described_class.cs_match_array( :bar )
         
     | 
| 
       155 
     | 
    
         
            -
                  expect( result.call( 'a', [ 'b', 'c', 'd' ] ) ).to eq( [ 'bar IN (?) AND bar IS NOT NULL', [ 'b', 'c', 'd' ] ] )
         
     | 
| 
       156 
     | 
    
         
            -
                end
         
     | 
| 
      
 151 
     | 
    
         
            +
                ###########################################################################
         
     | 
| 
       157 
152 
     | 
    
         | 
| 
       158 
     | 
    
         
            -
                 
     | 
| 
       159 
     | 
    
         
            -
                   
     | 
| 
       160 
     | 
    
         
            -
             
     | 
| 
      
 153 
     | 
    
         
            +
                context '#cs_match_array' do
         
     | 
| 
      
 154 
     | 
    
         
            +
                  it 'generates expected no-input-parameter output' do
         
     | 
| 
      
 155 
     | 
    
         
            +
                    result = described_class.cs_match_array()
         
     | 
| 
      
 156 
     | 
    
         
            +
                    expect( result.call( 'a', [ 'b', 'c', 'd' ] ) ).to eq( [ 'a IN (?) AND a IS NOT NULL', [ 'b', 'c', 'd' ] ] )
         
     | 
| 
      
 157 
     | 
    
         
            +
                  end
         
     | 
| 
       161 
158 
     | 
    
         | 
| 
       162 
     | 
    
         
            -
                   
     | 
| 
       163 
     | 
    
         
            -
             
     | 
| 
      
 159 
     | 
    
         
            +
                  it 'generates expected one-input-parameter output' do
         
     | 
| 
      
 160 
     | 
    
         
            +
                    result = described_class.cs_match_array( :bar )
         
     | 
| 
      
 161 
     | 
    
         
            +
                    expect( result.call( 'a', [ 'b', 'c', 'd' ] ) ).to eq( [ 'bar IN (?) AND bar IS NOT NULL', [ 'b', 'c', 'd' ] ] )
         
     | 
| 
      
 162 
     | 
    
         
            +
                  end
         
     | 
| 
       164 
163 
     | 
    
         | 
| 
       165 
     | 
    
         
            -
                   
     | 
| 
       166 
     | 
    
         
            -
             
     | 
| 
      
 164 
     | 
    
         
            +
                  it 'finds expected things' do
         
     | 
| 
      
 165 
     | 
    
         
            +
                    result = find( described_class.cs_match_array.call( 'field', [ 'hello', 'world' ] ) )
         
     | 
| 
      
 166 
     | 
    
         
            +
                    expect( result ).to match_array( [ @f2, @f3, @f6, @f7 ] )
         
     | 
| 
       167 
167 
     | 
    
         | 
| 
       168 
     | 
    
         
            -
             
     | 
| 
       169 
     | 
    
         
            -
             
     | 
| 
      
 168 
     | 
    
         
            +
                    result = find( described_class.cs_match_array.call( 'field', [ 'HELLO', 'WORLD' ] ) )
         
     | 
| 
      
 169 
     | 
    
         
            +
                    expect( result ).to match_array( [ @f4, @f8 ] )
         
     | 
| 
       170 
170 
     | 
    
         | 
| 
       171 
     | 
    
         
            -
             
     | 
| 
       172 
     | 
    
         
            -
             
     | 
| 
       173 
     | 
    
         
            -
                end
         
     | 
| 
      
 171 
     | 
    
         
            +
                    result = find( described_class.cs_match_array.call( 'field', [ 'hell', 'worl' ] ) )
         
     | 
| 
      
 172 
     | 
    
         
            +
                    expect( result ).to match_array( [] )
         
     | 
| 
       174 
173 
     | 
    
         | 
| 
       175 
     | 
    
         
            -
             
     | 
| 
       176 
     | 
    
         
            -
             
     | 
| 
       177 
     | 
    
         
            -
                  expect( result ).to match_array( [ @f1,           @f4, @f5,          @f8 ] )
         
     | 
| 
      
 174 
     | 
    
         
            +
                    result = find( described_class.cs_match_array.call( 'field', [ 'llo', 'ld' ] ) )
         
     | 
| 
      
 175 
     | 
    
         
            +
                    expect( result ).to match_array( [] )
         
     | 
| 
       178 
176 
     | 
    
         | 
| 
       179 
     | 
    
         
            -
             
     | 
| 
       180 
     | 
    
         
            -
             
     | 
| 
      
 177 
     | 
    
         
            +
                    result = find( described_class.cs_match_array.call( 'field', [ 'heLLo', 'WORld' ] ) )
         
     | 
| 
      
 178 
     | 
    
         
            +
                    expect( result ).to match_array( [] )
         
     | 
| 
      
 179 
     | 
    
         
            +
                  end
         
     | 
| 
       181 
180 
     | 
    
         | 
| 
       182 
     | 
    
         
            -
                   
     | 
| 
       183 
     | 
    
         
            -
             
     | 
| 
      
 181 
     | 
    
         
            +
                  it 'finds expected things negated' do
         
     | 
| 
      
 182 
     | 
    
         
            +
                    result = find_not( described_class.cs_match_array.call( 'field', [ 'hello', 'world' ] ) )
         
     | 
| 
      
 183 
     | 
    
         
            +
                    expect( result ).to match_array( [ @f1,           @f4, @f5,          @f8 ] )
         
     | 
| 
       184 
184 
     | 
    
         | 
| 
       185 
     | 
    
         
            -
             
     | 
| 
       186 
     | 
    
         
            -
             
     | 
| 
      
 185 
     | 
    
         
            +
                    result = find_not( described_class.cs_match_array.call( 'field', [ 'HELLO', 'WORLD' ] ) )
         
     | 
| 
      
 186 
     | 
    
         
            +
                    expect( result ).to match_array( [ @f1, @f2, @f3,      @f5, @f6, @f7      ] )
         
     | 
| 
       187 
187 
     | 
    
         | 
| 
       188 
     | 
    
         
            -
             
     | 
| 
       189 
     | 
    
         
            -
             
     | 
| 
       190 
     | 
    
         
            -
                end
         
     | 
| 
       191 
     | 
    
         
            -
              end
         
     | 
| 
      
 188 
     | 
    
         
            +
                    result = find_not( described_class.cs_match_array.call( 'field', [ 'hell', 'worl' ] ) )
         
     | 
| 
      
 189 
     | 
    
         
            +
                    expect( result ).to match_array( [ @f1, @f2, @f3, @f4, @f5, @f6, @f7, @f8 ] )
         
     | 
| 
       192 
190 
     | 
    
         | 
| 
       193 
     | 
    
         
            -
             
     | 
| 
      
 191 
     | 
    
         
            +
                    result = find_not( described_class.cs_match_array.call( 'field', [ 'llo', 'ld' ] ) )
         
     | 
| 
      
 192 
     | 
    
         
            +
                    expect( result ).to match_array( [ @f1, @f2, @f3, @f4, @f5, @f6, @f7, @f8 ] )
         
     | 
| 
       194 
193 
     | 
    
         | 
| 
       195 
     | 
    
         
            -
             
     | 
| 
       196 
     | 
    
         
            -
             
     | 
| 
       197 
     | 
    
         
            -
                   
     | 
| 
       198 
     | 
    
         
            -
                  expect( result.call( 'a', 'B' ) ).to eq( [ 'lower(a) = ? AND a IS NOT NULL', 'b' ] )
         
     | 
| 
      
 194 
     | 
    
         
            +
                    result = find_not( described_class.cs_match_array.call( 'field', [ 'heLLo', 'WORld' ] ) )
         
     | 
| 
      
 195 
     | 
    
         
            +
                    expect( result ).to match_array( [ @f1, @f2, @f3, @f4, @f5, @f6, @f7, @f8 ] )
         
     | 
| 
      
 196 
     | 
    
         
            +
                  end
         
     | 
| 
       199 
197 
     | 
    
         
             
                end
         
     | 
| 
       200 
198 
     | 
    
         | 
| 
       201 
     | 
    
         
            -
                 
     | 
| 
       202 
     | 
    
         
            -
                  result = described_class.ci_match_generic( :bar )
         
     | 
| 
       203 
     | 
    
         
            -
                  expect( result.call( 'a', 'B' ) ).to eq( [ 'lower(bar) = ? AND bar IS NOT NULL', 'b' ] )
         
     | 
| 
       204 
     | 
    
         
            -
                end
         
     | 
| 
      
 199 
     | 
    
         
            +
                ###########################################################################
         
     | 
| 
       205 
200 
     | 
    
         | 
| 
       206 
     | 
    
         
            -
                 
     | 
| 
       207 
     | 
    
         
            -
                   
     | 
| 
       208 
     | 
    
         
            -
             
     | 
| 
      
 201 
     | 
    
         
            +
                context '#ci_match_generic' do
         
     | 
| 
      
 202 
     | 
    
         
            +
                  it 'generates expected no-input-parameter output' do
         
     | 
| 
      
 203 
     | 
    
         
            +
                    result = described_class.ci_match_generic()
         
     | 
| 
      
 204 
     | 
    
         
            +
                    expect( result.call( 'a', 'B' ) ).to eq( [ 'lower(a) = ? AND a IS NOT NULL', 'b' ] )
         
     | 
| 
      
 205 
     | 
    
         
            +
                  end
         
     | 
| 
       209 
206 
     | 
    
         | 
| 
       210 
     | 
    
         
            -
                   
     | 
| 
       211 
     | 
    
         
            -
             
     | 
| 
      
 207 
     | 
    
         
            +
                  it 'generates expected one-input-parameter output' do
         
     | 
| 
      
 208 
     | 
    
         
            +
                    result = described_class.ci_match_generic( :bar )
         
     | 
| 
      
 209 
     | 
    
         
            +
                    expect( result.call( 'a', 'B' ) ).to eq( [ 'lower(bar) = ? AND bar IS NOT NULL', 'b' ] )
         
     | 
| 
      
 210 
     | 
    
         
            +
                  end
         
     | 
| 
       212 
211 
     | 
    
         | 
| 
       213 
     | 
    
         
            -
                   
     | 
| 
       214 
     | 
    
         
            -
             
     | 
| 
      
 212 
     | 
    
         
            +
                  it 'finds expected things' do
         
     | 
| 
      
 213 
     | 
    
         
            +
                    result = find( described_class.ci_match_generic.call( 'field', 'hello' ) )
         
     | 
| 
      
 214 
     | 
    
         
            +
                    expect( result ).to match_array( [ @f2, @f3, @f4 ] )
         
     | 
| 
       215 
215 
     | 
    
         | 
| 
       216 
     | 
    
         
            -
             
     | 
| 
       217 
     | 
    
         
            -
             
     | 
| 
      
 216 
     | 
    
         
            +
                    result = find( described_class.ci_match_generic.call( 'field', 'HELLO' ) )
         
     | 
| 
      
 217 
     | 
    
         
            +
                    expect( result ).to match_array( [ @f2, @f3, @f4 ] )
         
     | 
| 
       218 
218 
     | 
    
         | 
| 
       219 
     | 
    
         
            -
             
     | 
| 
       220 
     | 
    
         
            -
             
     | 
| 
       221 
     | 
    
         
            -
                end
         
     | 
| 
      
 219 
     | 
    
         
            +
                    result = find( described_class.ci_match_generic.call( 'field', 'hell' ) )
         
     | 
| 
      
 220 
     | 
    
         
            +
                    expect( result ).to match_array( [] )
         
     | 
| 
       222 
221 
     | 
    
         | 
| 
       223 
     | 
    
         
            -
             
     | 
| 
       224 
     | 
    
         
            -
             
     | 
| 
       225 
     | 
    
         
            -
                  expect( result ).to match_array( [ @f1,                @f5, @f6, @f7, @f8 ] )
         
     | 
| 
      
 222 
     | 
    
         
            +
                    result = find( described_class.ci_match_generic.call( 'field', 'llo' ) )
         
     | 
| 
      
 223 
     | 
    
         
            +
                    expect( result ).to match_array( [] )
         
     | 
| 
       226 
224 
     | 
    
         | 
| 
       227 
     | 
    
         
            -
             
     | 
| 
       228 
     | 
    
         
            -
             
     | 
| 
      
 225 
     | 
    
         
            +
                    result = find( described_class.ci_match_generic.call( 'field', 'heLLo' ) )
         
     | 
| 
      
 226 
     | 
    
         
            +
                    expect( result ).to match_array( [ @f2, @f3, @f4 ] )
         
     | 
| 
      
 227 
     | 
    
         
            +
                  end
         
     | 
| 
       229 
228 
     | 
    
         | 
| 
       230 
     | 
    
         
            -
                   
     | 
| 
       231 
     | 
    
         
            -
             
     | 
| 
      
 229 
     | 
    
         
            +
                  it 'finds expected things negated' do
         
     | 
| 
      
 230 
     | 
    
         
            +
                    result = find_not( described_class.ci_match_generic.call( 'field', 'hello' ) )
         
     | 
| 
      
 231 
     | 
    
         
            +
                    expect( result ).to match_array( [ @f1,                @f5, @f6, @f7, @f8 ] )
         
     | 
| 
       232 
232 
     | 
    
         | 
| 
       233 
     | 
    
         
            -
             
     | 
| 
       234 
     | 
    
         
            -
             
     | 
| 
      
 233 
     | 
    
         
            +
                    result = find_not( described_class.ci_match_generic.call( 'field', 'HELLO' ) )
         
     | 
| 
      
 234 
     | 
    
         
            +
                    expect( result ).to match_array( [ @f1,                @f5, @f6, @f7, @f8 ] )
         
     | 
| 
       235 
235 
     | 
    
         | 
| 
       236 
     | 
    
         
            -
             
     | 
| 
       237 
     | 
    
         
            -
             
     | 
| 
       238 
     | 
    
         
            -
                end
         
     | 
| 
       239 
     | 
    
         
            -
              end
         
     | 
| 
      
 236 
     | 
    
         
            +
                    result = find_not( described_class.ci_match_generic.call( 'field', 'hell' ) )
         
     | 
| 
      
 237 
     | 
    
         
            +
                    expect( result ).to match_array( [ @f1, @f2, @f3, @f4, @f5, @f6, @f7, @f8 ] )
         
     | 
| 
       240 
238 
     | 
    
         | 
| 
       241 
     | 
    
         
            -
             
     | 
| 
      
 239 
     | 
    
         
            +
                    result = find_not( described_class.ci_match_generic.call( 'field', 'llo' ) )
         
     | 
| 
      
 240 
     | 
    
         
            +
                    expect( result ).to match_array( [ @f1, @f2, @f3, @f4, @f5, @f6, @f7, @f8 ] )
         
     | 
| 
       242 
241 
     | 
    
         | 
| 
       243 
     | 
    
         
            -
             
     | 
| 
       244 
     | 
    
         
            -
             
     | 
| 
       245 
     | 
    
         
            -
                   
     | 
| 
       246 
     | 
    
         
            -
                  expect( result.call( 'a', 'B' ) ).to eq( [ 'lower(a) LIKE ? AND a IS NOT NULL', '%b%' ] )
         
     | 
| 
      
 242 
     | 
    
         
            +
                    result = find_not( described_class.ci_match_generic.call( 'field', 'heLLo' ) )
         
     | 
| 
      
 243 
     | 
    
         
            +
                    expect( result ).to match_array( [ @f1,                @f5, @f6, @f7, @f8 ] )
         
     | 
| 
      
 244 
     | 
    
         
            +
                  end
         
     | 
| 
       247 
245 
     | 
    
         
             
                end
         
     | 
| 
       248 
246 
     | 
    
         | 
| 
       249 
     | 
    
         
            -
                 
     | 
| 
       250 
     | 
    
         
            -
                  result = described_class.ciaw_match_generic( :bar )
         
     | 
| 
       251 
     | 
    
         
            -
                  expect( result.call( 'a', 'B' ) ).to eq( [ 'lower(bar) LIKE ? AND bar IS NOT NULL', '%b%' ] )
         
     | 
| 
       252 
     | 
    
         
            -
                end
         
     | 
| 
      
 247 
     | 
    
         
            +
                ###########################################################################
         
     | 
| 
       253 
248 
     | 
    
         | 
| 
       254 
     | 
    
         
            -
                 
     | 
| 
       255 
     | 
    
         
            -
                   
     | 
| 
       256 
     | 
    
         
            -
             
     | 
| 
      
 249 
     | 
    
         
            +
                context '#ciaw_match_generic' do
         
     | 
| 
      
 250 
     | 
    
         
            +
                  it 'generates expected no-input-parameter output' do
         
     | 
| 
      
 251 
     | 
    
         
            +
                    result = described_class.ciaw_match_generic()
         
     | 
| 
      
 252 
     | 
    
         
            +
                    expect( result.call( 'a', 'B' ) ).to eq( [ 'lower(a) LIKE ? AND a IS NOT NULL', '%b%' ] )
         
     | 
| 
      
 253 
     | 
    
         
            +
                  end
         
     | 
| 
       257 
254 
     | 
    
         | 
| 
       258 
     | 
    
         
            -
                   
     | 
| 
       259 
     | 
    
         
            -
             
     | 
| 
      
 255 
     | 
    
         
            +
                  it 'generates expected one-input-parameter output' do
         
     | 
| 
      
 256 
     | 
    
         
            +
                    result = described_class.ciaw_match_generic( :bar )
         
     | 
| 
      
 257 
     | 
    
         
            +
                    expect( result.call( 'a', 'B' ) ).to eq( [ 'lower(bar) LIKE ? AND bar IS NOT NULL', '%b%' ] )
         
     | 
| 
      
 258 
     | 
    
         
            +
                  end
         
     | 
| 
       260 
259 
     | 
    
         | 
| 
       261 
     | 
    
         
            -
                   
     | 
| 
       262 
     | 
    
         
            -
             
     | 
| 
      
 260 
     | 
    
         
            +
                  it 'finds expected things' do
         
     | 
| 
      
 261 
     | 
    
         
            +
                    result = find( described_class.ciaw_match_generic.call( 'field', 'hello' ) )
         
     | 
| 
      
 262 
     | 
    
         
            +
                    expect( result ).to match_array( [ @f2, @f3, @f4 ] )
         
     | 
| 
       263 
263 
     | 
    
         | 
| 
       264 
     | 
    
         
            -
             
     | 
| 
       265 
     | 
    
         
            -
             
     | 
| 
      
 264 
     | 
    
         
            +
                    result = find( described_class.ciaw_match_generic.call( 'field', 'HELLO' ) )
         
     | 
| 
      
 265 
     | 
    
         
            +
                    expect( result ).to match_array( [ @f2, @f3, @f4 ] )
         
     | 
| 
       266 
266 
     | 
    
         | 
| 
       267 
     | 
    
         
            -
             
     | 
| 
       268 
     | 
    
         
            -
             
     | 
| 
       269 
     | 
    
         
            -
                end
         
     | 
| 
      
 267 
     | 
    
         
            +
                    result = find( described_class.ciaw_match_generic.call( 'field', 'hell' ) )
         
     | 
| 
      
 268 
     | 
    
         
            +
                    expect( result ).to match_array( [ @f2, @f3, @f4 ] )
         
     | 
| 
       270 
269 
     | 
    
         | 
| 
       271 
     | 
    
         
            -
             
     | 
| 
       272 
     | 
    
         
            -
             
     | 
| 
       273 
     | 
    
         
            -
                  expect( result ).to match_array( [ @f1, @f5, @f6, @f7, @f8 ] )
         
     | 
| 
      
 270 
     | 
    
         
            +
                    result = find( described_class.ciaw_match_generic.call( 'field', 'llo' ) )
         
     | 
| 
      
 271 
     | 
    
         
            +
                    expect( result ).to match_array( [ @f2, @f3, @f4 ] )
         
     | 
| 
       274 
272 
     | 
    
         | 
| 
       275 
     | 
    
         
            -
             
     | 
| 
       276 
     | 
    
         
            -
             
     | 
| 
      
 273 
     | 
    
         
            +
                    result = find( described_class.ciaw_match_generic.call( 'field', 'heLLo' ) )
         
     | 
| 
      
 274 
     | 
    
         
            +
                    expect( result ).to match_array( [ @f2, @f3, @f4 ] )
         
     | 
| 
      
 275 
     | 
    
         
            +
                  end
         
     | 
| 
       277 
276 
     | 
    
         | 
| 
       278 
     | 
    
         
            -
                   
     | 
| 
       279 
     | 
    
         
            -
             
     | 
| 
      
 277 
     | 
    
         
            +
                  it 'finds expected things negated' do
         
     | 
| 
      
 278 
     | 
    
         
            +
                    result = find_not( described_class.ciaw_match_generic.call( 'field', 'hello' ) )
         
     | 
| 
      
 279 
     | 
    
         
            +
                    expect( result ).to match_array( [ @f1, @f5, @f6, @f7, @f8 ] )
         
     | 
| 
       280 
280 
     | 
    
         | 
| 
       281 
     | 
    
         
            -
             
     | 
| 
       282 
     | 
    
         
            -
             
     | 
| 
      
 281 
     | 
    
         
            +
                    result = find_not( described_class.ciaw_match_generic.call( 'field', 'HELLO' ) )
         
     | 
| 
      
 282 
     | 
    
         
            +
                    expect( result ).to match_array( [ @f1, @f5, @f6, @f7, @f8 ] )
         
     | 
| 
       283 
283 
     | 
    
         | 
| 
       284 
     | 
    
         
            -
             
     | 
| 
       285 
     | 
    
         
            -
             
     | 
| 
       286 
     | 
    
         
            -
                end
         
     | 
| 
       287 
     | 
    
         
            -
              end
         
     | 
| 
      
 284 
     | 
    
         
            +
                    result = find_not( described_class.ciaw_match_generic.call( 'field', 'hell' ) )
         
     | 
| 
      
 285 
     | 
    
         
            +
                    expect( result ).to match_array( [ @f1, @f5, @f6, @f7, @f8 ] )
         
     | 
| 
       288 
286 
     | 
    
         | 
| 
       289 
     | 
    
         
            -
             
     | 
| 
      
 287 
     | 
    
         
            +
                    result = find_not( described_class.ciaw_match_generic.call( 'field', 'llo' ) )
         
     | 
| 
      
 288 
     | 
    
         
            +
                    expect( result ).to match_array( [ @f1, @f5, @f6, @f7, @f8 ] )
         
     | 
| 
       290 
289 
     | 
    
         | 
| 
       291 
     | 
    
         
            -
             
     | 
| 
       292 
     | 
    
         
            -
             
     | 
| 
       293 
     | 
    
         
            -
                   
     | 
| 
       294 
     | 
    
         
            -
                  expect( result.call( 'a', 'B' ) ).to eq( [ 'a LIKE ? AND a IS NOT NULL', '%B%' ] )
         
     | 
| 
      
 290 
     | 
    
         
            +
                    result = find_not( described_class.ciaw_match_generic.call( 'field', 'heLLo' ) )
         
     | 
| 
      
 291 
     | 
    
         
            +
                    expect( result ).to match_array( [ @f1, @f5, @f6, @f7, @f8 ] )
         
     | 
| 
      
 292 
     | 
    
         
            +
                  end
         
     | 
| 
       295 
293 
     | 
    
         
             
                end
         
     | 
| 
       296 
294 
     | 
    
         | 
| 
       297 
     | 
    
         
            -
                 
     | 
| 
       298 
     | 
    
         
            -
             
     | 
| 
       299 
     | 
    
         
            -
             
     | 
| 
      
 295 
     | 
    
         
            +
                ###########################################################################
         
     | 
| 
      
 296 
     | 
    
         
            +
             
     | 
| 
      
 297 
     | 
    
         
            +
                context '#csaw_match' do
         
     | 
| 
      
 298 
     | 
    
         
            +
                  it 'generates expected no-input-parameter output' do
         
     | 
| 
      
 299 
     | 
    
         
            +
                    result = described_class.csaw_match()
         
     | 
| 
      
 300 
     | 
    
         
            +
                    expect( result.call( 'a', 'B' ) ).to eq( [ 'a LIKE ? AND a IS NOT NULL', '%B%' ] )
         
     | 
| 
      
 301 
     | 
    
         
            +
                  end
         
     | 
| 
      
 302 
     | 
    
         
            +
             
     | 
| 
      
 303 
     | 
    
         
            +
                  it 'generates expected one-input-parameter output' do
         
     | 
| 
      
 304 
     | 
    
         
            +
                    result = described_class.csaw_match( :bar )
         
     | 
| 
      
 305 
     | 
    
         
            +
                    expect( result.call( 'a', 'B' ) ).to eq( [ 'bar LIKE ? AND bar IS NOT NULL', '%B%' ] )
         
     | 
| 
      
 306 
     | 
    
         
            +
                  end
         
     | 
| 
      
 307 
     | 
    
         
            +
             
     | 
| 
      
 308 
     | 
    
         
            +
                  it 'finds expected things' do
         
     | 
| 
      
 309 
     | 
    
         
            +
                    result = find( described_class.csaw_match.call( 'field', 'hello' ) )
         
     | 
| 
      
 310 
     | 
    
         
            +
                    expect( result ).to match_array( [ @f2, @f3 ] )
         
     | 
| 
      
 311 
     | 
    
         
            +
             
     | 
| 
      
 312 
     | 
    
         
            +
                    result = find( described_class.csaw_match.call( 'field', 'HELLO' ) )
         
     | 
| 
      
 313 
     | 
    
         
            +
                    expect( result ).to match_array( [ @f4 ] )
         
     | 
| 
      
 314 
     | 
    
         
            +
             
     | 
| 
      
 315 
     | 
    
         
            +
                    result = find( described_class.csaw_match.call( 'field', 'hell' ) )
         
     | 
| 
      
 316 
     | 
    
         
            +
                    expect( result ).to match_array( [ @f2, @f3 ] )
         
     | 
| 
      
 317 
     | 
    
         
            +
             
     | 
| 
      
 318 
     | 
    
         
            +
                    result = find( described_class.csaw_match.call( 'field', 'llo' ) )
         
     | 
| 
      
 319 
     | 
    
         
            +
                    expect( result ).to match_array( [ @f2, @f3 ] )
         
     | 
| 
      
 320 
     | 
    
         
            +
             
     | 
| 
      
 321 
     | 
    
         
            +
                    result = find( described_class.csaw_match.call( 'field', 'heLLo' ) )
         
     | 
| 
      
 322 
     | 
    
         
            +
                    expect( result ).to match_array( [  ] )
         
     | 
| 
      
 323 
     | 
    
         
            +
                  end
         
     | 
| 
      
 324 
     | 
    
         
            +
             
     | 
| 
      
 325 
     | 
    
         
            +
                  it 'finds expected things negated' do
         
     | 
| 
      
 326 
     | 
    
         
            +
                    result = find_not( described_class.csaw_match.call( 'field', 'hello' ) )
         
     | 
| 
      
 327 
     | 
    
         
            +
                    expect( result ).to match_array( [ @f1, @f4, @f5, @f6, @f7, @f8 ] )
         
     | 
| 
      
 328 
     | 
    
         
            +
             
     | 
| 
      
 329 
     | 
    
         
            +
                    result = find_not( described_class.csaw_match.call( 'field', 'HELLO' ) )
         
     | 
| 
      
 330 
     | 
    
         
            +
                    expect( result ).to match_array( [ @f1, @f2, @f3, @f5, @f6, @f7, @f8 ] )
         
     | 
| 
      
 331 
     | 
    
         
            +
             
     | 
| 
      
 332 
     | 
    
         
            +
                    result = find_not( described_class.csaw_match.call( 'field', 'hell' ) )
         
     | 
| 
      
 333 
     | 
    
         
            +
                    expect( result ).to match_array( [ @f1, @f4, @f5, @f6, @f7, @f8 ] )
         
     | 
| 
      
 334 
     | 
    
         
            +
             
     | 
| 
      
 335 
     | 
    
         
            +
                    result = find_not( described_class.csaw_match.call( 'field', 'llo' ) )
         
     | 
| 
      
 336 
     | 
    
         
            +
                    expect( result ).to match_array( [ @f1, @f4, @f5, @f6, @f7, @f8 ] )
         
     | 
| 
      
 337 
     | 
    
         
            +
             
     | 
| 
      
 338 
     | 
    
         
            +
                    result = find_not( described_class.csaw_match.call( 'field', 'heLLo' ) )
         
     | 
| 
      
 339 
     | 
    
         
            +
                    expect( result ).to match_array( [ @f1, @f2, @f3, @f4, @f5, @f6, @f7, @f8 ] )
         
     | 
| 
      
 340 
     | 
    
         
            +
                  end
         
     | 
| 
       300 
341 
     | 
    
         
             
                end
         
     | 
| 
       301 
342 
     | 
    
         | 
| 
       302 
     | 
    
         
            -
                 
     | 
| 
       303 
     | 
    
         
            -
             
     | 
| 
       304 
     | 
    
         
            -
             
     | 
| 
      
 343 
     | 
    
         
            +
                ###########################################################################
         
     | 
| 
      
 344 
     | 
    
         
            +
             
     | 
| 
      
 345 
     | 
    
         
            +
                context '#ci_match_postgres' do
         
     | 
| 
      
 346 
     | 
    
         
            +
                  it 'generates expected no-input-parameter output' do
         
     | 
| 
      
 347 
     | 
    
         
            +
                    result = described_class.ci_match_postgres()
         
     | 
| 
      
 348 
     | 
    
         
            +
                    expect( result.call( 'a', 'B' ) ).to eq( [ 'a ILIKE ? AND a IS NOT NULL', 'B' ] )
         
     | 
| 
      
 349 
     | 
    
         
            +
                  end
         
     | 
| 
      
 350 
     | 
    
         
            +
             
     | 
| 
      
 351 
     | 
    
         
            +
                  it 'generates expected one-input-parameter output' do
         
     | 
| 
      
 352 
     | 
    
         
            +
                    result = described_class.ci_match_postgres( :bar )
         
     | 
| 
      
 353 
     | 
    
         
            +
                    expect( result.call( 'a', 'B' ) ).to eq( [ 'bar ILIKE ? AND bar IS NOT NULL', 'B' ] )
         
     | 
| 
      
 354 
     | 
    
         
            +
                  end
         
     | 
| 
       305 
355 
     | 
    
         | 
| 
       306 
     | 
    
         
            -
                   
     | 
| 
       307 
     | 
    
         
            -
             
     | 
| 
      
 356 
     | 
    
         
            +
                  it 'finds expected things' do
         
     | 
| 
      
 357 
     | 
    
         
            +
                    result = find( described_class.ci_match_postgres.call( 'field', 'hello' ) )
         
     | 
| 
      
 358 
     | 
    
         
            +
                    expect( result ).to match_array( [ @f2, @f3, @f4 ] )
         
     | 
| 
       308 
359 
     | 
    
         | 
| 
       309 
     | 
    
         
            -
             
     | 
| 
       310 
     | 
    
         
            -
             
     | 
| 
      
 360 
     | 
    
         
            +
                    result = find( described_class.ci_match_postgres.call( 'field', 'HELLO' ) )
         
     | 
| 
      
 361 
     | 
    
         
            +
                    expect( result ).to match_array( [ @f2, @f3, @f4 ] )
         
     | 
| 
      
 362 
     | 
    
         
            +
             
     | 
| 
      
 363 
     | 
    
         
            +
                    result = find( described_class.ci_match_postgres.call( 'field', 'hell' ) )
         
     | 
| 
      
 364 
     | 
    
         
            +
                    expect( result ).to match_array( [] )
         
     | 
| 
      
 365 
     | 
    
         
            +
             
     | 
| 
      
 366 
     | 
    
         
            +
                    result = find( described_class.ci_match_postgres.call( 'field', 'llo' ) )
         
     | 
| 
      
 367 
     | 
    
         
            +
                    expect( result ).to match_array( [] )
         
     | 
| 
      
 368 
     | 
    
         
            +
             
     | 
| 
      
 369 
     | 
    
         
            +
                    result = find( described_class.ci_match_postgres.call( 'field', 'heLLo' ) )
         
     | 
| 
      
 370 
     | 
    
         
            +
                    expect( result ).to match_array( [ @f2, @f3, @f4 ] )
         
     | 
| 
      
 371 
     | 
    
         
            +
                  end
         
     | 
| 
       311 
372 
     | 
    
         | 
| 
       312 
     | 
    
         
            -
                   
     | 
| 
       313 
     | 
    
         
            -
             
     | 
| 
      
 373 
     | 
    
         
            +
                  it 'finds expected things negated' do
         
     | 
| 
      
 374 
     | 
    
         
            +
                    result = find_not( described_class.ci_match_postgres.call( 'field', 'hello' ) )
         
     | 
| 
      
 375 
     | 
    
         
            +
                    expect( result ).to match_array( [ @f1,                @f5, @f6, @f7, @f8 ] )
         
     | 
| 
       314 
376 
     | 
    
         | 
| 
       315 
     | 
    
         
            -
             
     | 
| 
       316 
     | 
    
         
            -
             
     | 
| 
      
 377 
     | 
    
         
            +
                    result = find_not( described_class.ci_match_postgres.call( 'field', 'HELLO' ) )
         
     | 
| 
      
 378 
     | 
    
         
            +
                    expect( result ).to match_array( [ @f1,                @f5, @f6, @f7, @f8 ] )
         
     | 
| 
      
 379 
     | 
    
         
            +
             
     | 
| 
      
 380 
     | 
    
         
            +
                    result = find_not( described_class.ci_match_postgres.call( 'field', 'hell' ) )
         
     | 
| 
      
 381 
     | 
    
         
            +
                    expect( result ).to match_array( [ @f1, @f2, @f3, @f4, @f5, @f6, @f7, @f8 ] )
         
     | 
| 
      
 382 
     | 
    
         
            +
             
     | 
| 
      
 383 
     | 
    
         
            +
                    result = find_not( described_class.ci_match_postgres.call( 'field', 'llo' ) )
         
     | 
| 
      
 384 
     | 
    
         
            +
                    expect( result ).to match_array( [ @f1, @f2, @f3, @f4, @f5, @f6, @f7, @f8 ] )
         
     | 
| 
      
 385 
     | 
    
         
            +
             
     | 
| 
      
 386 
     | 
    
         
            +
                    result = find_not( described_class.ci_match_postgres.call( 'field', 'heLLo' ) )
         
     | 
| 
      
 387 
     | 
    
         
            +
                    expect( result ).to match_array( [ @f1,                @f5, @f6, @f7, @f8 ] )
         
     | 
| 
      
 388 
     | 
    
         
            +
                  end
         
     | 
| 
       317 
389 
     | 
    
         
             
                end
         
     | 
| 
       318 
390 
     | 
    
         | 
| 
       319 
     | 
    
         
            -
                 
     | 
| 
       320 
     | 
    
         
            -
             
     | 
| 
       321 
     | 
    
         
            -
             
     | 
| 
      
 391 
     | 
    
         
            +
                ###########################################################################
         
     | 
| 
      
 392 
     | 
    
         
            +
             
     | 
| 
      
 393 
     | 
    
         
            +
                context '#ciaw_match_postgres' do
         
     | 
| 
      
 394 
     | 
    
         
            +
                  it 'generates expected no-input-parameter output' do
         
     | 
| 
      
 395 
     | 
    
         
            +
                    result = described_class.ciaw_match_postgres()
         
     | 
| 
      
 396 
     | 
    
         
            +
                    expect( result.call( 'a', 'B' ) ).to eq( [ 'a ILIKE ? AND a IS NOT NULL', '%B%' ] )
         
     | 
| 
      
 397 
     | 
    
         
            +
                  end
         
     | 
| 
      
 398 
     | 
    
         
            +
             
     | 
| 
      
 399 
     | 
    
         
            +
                  it 'generates expected one-input-parameter output' do
         
     | 
| 
      
 400 
     | 
    
         
            +
                    result = described_class.ciaw_match_postgres( :bar )
         
     | 
| 
      
 401 
     | 
    
         
            +
                    expect( result.call( 'a', 'B' ) ).to eq( [ 'bar ILIKE ? AND bar IS NOT NULL', '%B%' ] )
         
     | 
| 
      
 402 
     | 
    
         
            +
                  end
         
     | 
| 
      
 403 
     | 
    
         
            +
             
     | 
| 
      
 404 
     | 
    
         
            +
                  it 'finds expected things' do
         
     | 
| 
      
 405 
     | 
    
         
            +
                    result = find( described_class.ciaw_match_postgres.call( 'field', 'hello' ) )
         
     | 
| 
      
 406 
     | 
    
         
            +
                    expect( result ).to match_array( [ @f2, @f3, @f4 ] )
         
     | 
| 
       322 
407 
     | 
    
         | 
| 
       323 
     | 
    
         
            -
             
     | 
| 
       324 
     | 
    
         
            -
             
     | 
| 
      
 408 
     | 
    
         
            +
                    result = find( described_class.ciaw_match_postgres.call( 'field', 'HELLO' ) )
         
     | 
| 
      
 409 
     | 
    
         
            +
                    expect( result ).to match_array( [ @f2, @f3, @f4 ] )
         
     | 
| 
       325 
410 
     | 
    
         | 
| 
       326 
     | 
    
         
            -
             
     | 
| 
       327 
     | 
    
         
            -
             
     | 
| 
      
 411 
     | 
    
         
            +
                    result = find( described_class.ciaw_match_postgres.call( 'field', 'hell' ) )
         
     | 
| 
      
 412 
     | 
    
         
            +
                    expect( result ).to match_array( [ @f2, @f3, @f4 ] )
         
     | 
| 
       328 
413 
     | 
    
         | 
| 
       329 
     | 
    
         
            -
             
     | 
| 
       330 
     | 
    
         
            -
             
     | 
| 
      
 414 
     | 
    
         
            +
                    result = find( described_class.ciaw_match_postgres.call( 'field', 'llo' ) )
         
     | 
| 
      
 415 
     | 
    
         
            +
                    expect( result ).to match_array( [ @f2, @f3, @f4 ] )
         
     | 
| 
       331 
416 
     | 
    
         | 
| 
       332 
     | 
    
         
            -
             
     | 
| 
       333 
     | 
    
         
            -
             
     | 
| 
      
 417 
     | 
    
         
            +
                    result = find( described_class.ciaw_match_postgres.call( 'field', 'heLLo' ) )
         
     | 
| 
      
 418 
     | 
    
         
            +
                    expect( result ).to match_array( [ @f2, @f3, @f4 ] )
         
     | 
| 
      
 419 
     | 
    
         
            +
                  end
         
     | 
| 
      
 420 
     | 
    
         
            +
             
     | 
| 
      
 421 
     | 
    
         
            +
                  it 'finds expected things negated' do
         
     | 
| 
      
 422 
     | 
    
         
            +
                    result = find_not( described_class.ciaw_match_postgres.call( 'field', 'hello' ) )
         
     | 
| 
      
 423 
     | 
    
         
            +
                    expect( result ).to match_array( [ @f1, @f5, @f6, @f7, @f8 ] )
         
     | 
| 
      
 424 
     | 
    
         
            +
             
     | 
| 
      
 425 
     | 
    
         
            +
                    result = find_not( described_class.ciaw_match_postgres.call( 'field', 'HELLO' ) )
         
     | 
| 
      
 426 
     | 
    
         
            +
                    expect( result ).to match_array( [ @f1, @f5, @f6, @f7, @f8 ] )
         
     | 
| 
      
 427 
     | 
    
         
            +
             
     | 
| 
      
 428 
     | 
    
         
            +
                    result = find_not( described_class.ciaw_match_postgres.call( 'field', 'hell' ) )
         
     | 
| 
      
 429 
     | 
    
         
            +
                    expect( result ).to match_array( [ @f1, @f5, @f6, @f7, @f8 ] )
         
     | 
| 
      
 430 
     | 
    
         
            +
             
     | 
| 
      
 431 
     | 
    
         
            +
                    result = find_not( described_class.ciaw_match_postgres.call( 'field', 'llo' ) )
         
     | 
| 
      
 432 
     | 
    
         
            +
                    expect( result ).to match_array( [ @f1, @f5, @f6, @f7, @f8 ] )
         
     | 
| 
      
 433 
     | 
    
         
            +
             
     | 
| 
      
 434 
     | 
    
         
            +
                    result = find_not( described_class.ciaw_match_postgres.call( 'field', 'heLLo' ) )
         
     | 
| 
      
 435 
     | 
    
         
            +
                    expect( result ).to match_array( [ @f1, @f5, @f6, @f7, @f8 ] )
         
     | 
| 
      
 436 
     | 
    
         
            +
                  end
         
     | 
| 
       334 
437 
     | 
    
         
             
                end
         
     | 
| 
      
 438 
     | 
    
         
            +
             
     | 
| 
      
 439 
     | 
    
         
            +
                ###########################################################################
         
     | 
| 
      
 440 
     | 
    
         
            +
             
     | 
| 
       335 
441 
     | 
    
         
             
              end
         
     | 
| 
       336 
442 
     | 
    
         | 
| 
      
 443 
     | 
    
         
            +
              #############################################################################
         
     | 
| 
      
 444 
     | 
    
         
            +
              # Although the queries in this section can match things other than dates
         
     | 
| 
      
 445 
     | 
    
         
            +
              # easily - e.g. compare integers or strings - they were created initially
         
     | 
| 
      
 446 
     | 
    
         
            +
              # for date comparisons so the seed data for tests is based on dates only.
         
     | 
| 
       337 
447 
     | 
    
         
             
              #############################################################################
         
     | 
| 
       338 
448 
     | 
    
         | 
| 
       339 
     | 
    
         
            -
              context ' 
     | 
| 
       340 
     | 
    
         
            -
                 
     | 
| 
       341 
     | 
    
         
            -
                   
     | 
| 
       342 
     | 
    
         
            -
                   
     | 
| 
       343 
     | 
    
         
            -
             
     | 
| 
      
 449 
     | 
    
         
            +
              context 'difference' do
         
     | 
| 
      
 450 
     | 
    
         
            +
                before :each do
         
     | 
| 
      
 451 
     | 
    
         
            +
                  @tn = Time.now.round()
         
     | 
| 
      
 452 
     | 
    
         
            +
                  @t1 = RSpecModelSearchHelperTest.create( :created_at => @tn           )
         
     | 
| 
      
 453 
     | 
    
         
            +
                  @t2 = RSpecModelSearchHelperTest.create( :created_at => @tn           )
         
     | 
| 
      
 454 
     | 
    
         
            +
                  @t3 = RSpecModelSearchHelperTest.create( :created_at => @tn - 1.month )
         
     | 
| 
      
 455 
     | 
    
         
            +
                  @t4 = RSpecModelSearchHelperTest.create( :created_at => @tn - 1.month )
         
     | 
| 
      
 456 
     | 
    
         
            +
                  @t5 = RSpecModelSearchHelperTest.create( :created_at => @tn - 1.year  )
         
     | 
| 
      
 457 
     | 
    
         
            +
                  @t6 = RSpecModelSearchHelperTest.create( :created_at => @tn - 1.year  )
         
     | 
| 
      
 458 
     | 
    
         
            +
                  @t7 = RSpecModelSearchHelperTest.create
         
     | 
| 
       344 
459 
     | 
    
         | 
| 
       345 
     | 
    
         
            -
             
     | 
| 
       346 
     | 
    
         
            -
                   
     | 
| 
       347 
     | 
    
         
            -
                  expect( result.call( 'a', 'B' ) ).to eq( [ 'bar ILIKE ? AND bar IS NOT NULL', 'B' ] )
         
     | 
| 
      
 460 
     | 
    
         
            +
                  sql = "UPDATE r_spec_model_search_helper_tests SET created_at=NULL WHERE id=#{ @t7.id }"
         
     | 
| 
      
 461 
     | 
    
         
            +
                  ActiveRecord::Base.connection.execute( sql )
         
     | 
| 
       348 
462 
     | 
    
         
             
                end
         
     | 
| 
       349 
463 
     | 
    
         | 
| 
       350 
     | 
    
         
            -
                 
     | 
| 
       351 
     | 
    
         
            -
                  result = find( described_class.ci_match_postgres.call( 'field', 'hello' ) )
         
     | 
| 
       352 
     | 
    
         
            -
                  expect( result ).to match_array( [ @f2, @f3, @f4 ] )
         
     | 
| 
      
 464 
     | 
    
         
            +
                ###########################################################################
         
     | 
| 
       353 
465 
     | 
    
         | 
| 
       354 
     | 
    
         
            -
             
     | 
| 
       355 
     | 
    
         
            -
                   
     | 
| 
      
 466 
     | 
    
         
            +
                context '#cs_lt' do
         
     | 
| 
      
 467 
     | 
    
         
            +
                  it 'generates expected no-input-parameter output' do
         
     | 
| 
      
 468 
     | 
    
         
            +
                    result = described_class.cs_lt()
         
     | 
| 
      
 469 
     | 
    
         
            +
                    expect( result.call( 'a', 'b' ) ).to eq( [ 'a < ? AND a IS NOT NULL', 'b' ] )
         
     | 
| 
      
 470 
     | 
    
         
            +
                  end
         
     | 
| 
       356 
471 
     | 
    
         | 
| 
       357 
     | 
    
         
            -
                   
     | 
| 
       358 
     | 
    
         
            -
             
     | 
| 
      
 472 
     | 
    
         
            +
                  it 'generates expected one-input-parameter output' do
         
     | 
| 
      
 473 
     | 
    
         
            +
                    result = described_class.cs_lt( :bar )
         
     | 
| 
      
 474 
     | 
    
         
            +
                    expect( result.call( 'a', 'b' ) ).to eq( [ 'bar < ? AND bar IS NOT NULL', 'b' ] )
         
     | 
| 
      
 475 
     | 
    
         
            +
                  end
         
     | 
| 
       359 
476 
     | 
    
         | 
| 
       360 
     | 
    
         
            -
                   
     | 
| 
       361 
     | 
    
         
            -
             
     | 
| 
      
 477 
     | 
    
         
            +
                  it 'finds expected things' do
         
     | 
| 
      
 478 
     | 
    
         
            +
                    result = find( described_class.cs_lt.call( 'created_at', @tn ) )
         
     | 
| 
      
 479 
     | 
    
         
            +
                    expect( result ).to match_array( [ @t3, @t4, @t5, @t6 ] )
         
     | 
| 
       362 
480 
     | 
    
         | 
| 
       363 
     | 
    
         
            -
             
     | 
| 
       364 
     | 
    
         
            -
             
     | 
| 
       365 
     | 
    
         
            -
                end
         
     | 
| 
      
 481 
     | 
    
         
            +
                    result = find( described_class.cs_lt.call( 'created_at', ( @tn - 2.months ) ) )
         
     | 
| 
      
 482 
     | 
    
         
            +
                    expect( result ).to match_array( [ @t5, @t6 ] )
         
     | 
| 
       366 
483 
     | 
    
         | 
| 
       367 
     | 
    
         
            -
             
     | 
| 
       368 
     | 
    
         
            -
             
     | 
| 
       369 
     | 
    
         
            -
                  expect( result ).to match_array( [ @f1,                @f5, @f6, @f7, @f8 ] )
         
     | 
| 
      
 484 
     | 
    
         
            +
                    result = find( described_class.cs_lt.call( 'created_at', ( @tn + 1.month ) ) )
         
     | 
| 
      
 485 
     | 
    
         
            +
                    expect( result ).to match_array( [ @t1, @t2, @t3, @t4, @t5, @t6 ] )
         
     | 
| 
       370 
486 
     | 
    
         | 
| 
       371 
     | 
    
         
            -
             
     | 
| 
       372 
     | 
    
         
            -
             
     | 
| 
      
 487 
     | 
    
         
            +
                    result = find( described_class.cs_lt.call( 'created_at', ( @tn - 1.year ) ) )
         
     | 
| 
      
 488 
     | 
    
         
            +
                    expect( result ).to match_array( [] )
         
     | 
| 
       373 
489 
     | 
    
         | 
| 
       374 
     | 
    
         
            -
             
     | 
| 
       375 
     | 
    
         
            -
             
     | 
| 
      
 490 
     | 
    
         
            +
                    result = find( described_class.cs_lt.call( 'created_at', ( @tn - 2.years ) ) )
         
     | 
| 
      
 491 
     | 
    
         
            +
                    expect( result ).to match_array( [] )
         
     | 
| 
      
 492 
     | 
    
         
            +
                  end
         
     | 
| 
       376 
493 
     | 
    
         | 
| 
       377 
     | 
    
         
            -
                   
     | 
| 
       378 
     | 
    
         
            -
             
     | 
| 
      
 494 
     | 
    
         
            +
                  it 'finds expected things negated' do
         
     | 
| 
      
 495 
     | 
    
         
            +
                    result = find_not( described_class.cs_lt.call( 'created_at', @tn ) )
         
     | 
| 
      
 496 
     | 
    
         
            +
                    expect( result ).to match_array( [ @t1, @t2, @t7 ] )
         
     | 
| 
       379 
497 
     | 
    
         | 
| 
       380 
     | 
    
         
            -
             
     | 
| 
       381 
     | 
    
         
            -
             
     | 
| 
       382 
     | 
    
         
            -
                end
         
     | 
| 
       383 
     | 
    
         
            -
              end
         
     | 
| 
      
 498 
     | 
    
         
            +
                    result = find_not( described_class.cs_lt.call( 'created_at', ( @tn - 2.months ) ) )
         
     | 
| 
      
 499 
     | 
    
         
            +
                    expect( result ).to match_array( [ @t1, @t2, @t3, @t4, @t7 ] )
         
     | 
| 
       384 
500 
     | 
    
         | 
| 
       385 
     | 
    
         
            -
             
     | 
| 
      
 501 
     | 
    
         
            +
                    result = find_not( described_class.cs_lt.call( 'created_at', ( @tn + 1.month ) ) )
         
     | 
| 
      
 502 
     | 
    
         
            +
                    expect( result ).to match_array( [ @t7 ] )
         
     | 
| 
       386 
503 
     | 
    
         | 
| 
       387 
     | 
    
         
            -
             
     | 
| 
       388 
     | 
    
         
            -
             
     | 
| 
       389 
     | 
    
         
            -
             
     | 
| 
       390 
     | 
    
         
            -
             
     | 
| 
      
 504 
     | 
    
         
            +
                    result = find_not( described_class.cs_lt.call( 'created_at', ( @tn - 1.year ) ) )
         
     | 
| 
      
 505 
     | 
    
         
            +
                    expect( result ).to match_array( [ @t1, @t2, @t3, @t4, @t5, @t6, @t7 ] )
         
     | 
| 
      
 506 
     | 
    
         
            +
             
     | 
| 
      
 507 
     | 
    
         
            +
                    result = find_not( described_class.cs_lt.call( 'created_at', ( @tn - 2.years ) ) )
         
     | 
| 
      
 508 
     | 
    
         
            +
                    expect( result ).to match_array( [ @t1, @t2, @t3, @t4, @t5, @t6, @t7 ] )
         
     | 
| 
      
 509 
     | 
    
         
            +
                  end
         
     | 
| 
       391 
510 
     | 
    
         
             
                end
         
     | 
| 
       392 
511 
     | 
    
         | 
| 
       393 
     | 
    
         
            -
                 
     | 
| 
       394 
     | 
    
         
            -
             
     | 
| 
       395 
     | 
    
         
            -
             
     | 
| 
      
 512 
     | 
    
         
            +
                ###########################################################################
         
     | 
| 
      
 513 
     | 
    
         
            +
             
     | 
| 
      
 514 
     | 
    
         
            +
                context '#cs_lte' do
         
     | 
| 
      
 515 
     | 
    
         
            +
                  it 'generates expected no-input-parameter output' do
         
     | 
| 
      
 516 
     | 
    
         
            +
                    result = described_class.cs_lte()
         
     | 
| 
      
 517 
     | 
    
         
            +
                    expect( result.call( 'a', 'b' ) ).to eq( [ 'a <= ? AND a IS NOT NULL', 'b' ] )
         
     | 
| 
      
 518 
     | 
    
         
            +
                  end
         
     | 
| 
      
 519 
     | 
    
         
            +
             
     | 
| 
      
 520 
     | 
    
         
            +
                  it 'generates expected one-input-parameter output' do
         
     | 
| 
      
 521 
     | 
    
         
            +
                    result = described_class.cs_lte( :bar )
         
     | 
| 
      
 522 
     | 
    
         
            +
                    expect( result.call( 'a', 'b' ) ).to eq( [ 'bar <= ? AND bar IS NOT NULL', 'b' ] )
         
     | 
| 
      
 523 
     | 
    
         
            +
                  end
         
     | 
| 
      
 524 
     | 
    
         
            +
             
     | 
| 
      
 525 
     | 
    
         
            +
                  it 'finds expected things' do
         
     | 
| 
      
 526 
     | 
    
         
            +
                    result = find( described_class.cs_lte.call( 'created_at', @tn ) )
         
     | 
| 
      
 527 
     | 
    
         
            +
                    expect( result ).to match_array( [ @t1, @t2, @t3, @t4, @t5, @t6 ] )
         
     | 
| 
      
 528 
     | 
    
         
            +
             
     | 
| 
      
 529 
     | 
    
         
            +
                    result = find( described_class.cs_lte.call( 'created_at', ( @tn - 2.months ) ) )
         
     | 
| 
      
 530 
     | 
    
         
            +
                    expect( result ).to match_array( [ @t5, @t6 ] )
         
     | 
| 
      
 531 
     | 
    
         
            +
             
     | 
| 
      
 532 
     | 
    
         
            +
                    result = find( described_class.cs_lte.call( 'created_at', ( @tn + 1.month ) ) )
         
     | 
| 
      
 533 
     | 
    
         
            +
                    expect( result ).to match_array( [ @t1, @t2, @t3, @t4, @t5, @t6 ] )
         
     | 
| 
      
 534 
     | 
    
         
            +
             
     | 
| 
      
 535 
     | 
    
         
            +
                    result = find( described_class.cs_lte.call( 'created_at', ( @tn - 1.year ) ) )
         
     | 
| 
      
 536 
     | 
    
         
            +
                    expect( result ).to match_array( [ @t5, @t6 ] )
         
     | 
| 
      
 537 
     | 
    
         
            +
             
     | 
| 
      
 538 
     | 
    
         
            +
                    result = find( described_class.cs_lte.call( 'created_at', ( @tn - 2.years ) ) )
         
     | 
| 
      
 539 
     | 
    
         
            +
                    expect( result ).to match_array( [] )
         
     | 
| 
      
 540 
     | 
    
         
            +
                  end
         
     | 
| 
      
 541 
     | 
    
         
            +
             
     | 
| 
      
 542 
     | 
    
         
            +
                  it 'finds expected things negated' do
         
     | 
| 
      
 543 
     | 
    
         
            +
                    result = find_not( described_class.cs_lte.call( 'created_at', @tn ) )
         
     | 
| 
      
 544 
     | 
    
         
            +
                    expect( result ).to match_array( [ @t7 ] )
         
     | 
| 
      
 545 
     | 
    
         
            +
             
     | 
| 
      
 546 
     | 
    
         
            +
                    result = find_not( described_class.cs_lte.call( 'created_at', ( @tn - 2.months ) ) )
         
     | 
| 
      
 547 
     | 
    
         
            +
                    expect( result ).to match_array( [ @t1, @t2, @t3, @t4, @t7 ] )
         
     | 
| 
      
 548 
     | 
    
         
            +
             
     | 
| 
      
 549 
     | 
    
         
            +
                    result = find_not( described_class.cs_lte.call( 'created_at', ( @tn + 1.month ) ) )
         
     | 
| 
      
 550 
     | 
    
         
            +
                    expect( result ).to match_array( [ @t7 ] )
         
     | 
| 
      
 551 
     | 
    
         
            +
             
     | 
| 
      
 552 
     | 
    
         
            +
                    result = find_not( described_class.cs_lte.call( 'created_at', ( @tn - 1.year ) ) )
         
     | 
| 
      
 553 
     | 
    
         
            +
                    expect( result ).to match_array( [ @t1, @t2, @t3, @t4, @t7 ] )
         
     | 
| 
      
 554 
     | 
    
         
            +
             
     | 
| 
      
 555 
     | 
    
         
            +
                    result = find_not( described_class.cs_lte.call( 'created_at', ( @tn - 2.years ) ) )
         
     | 
| 
      
 556 
     | 
    
         
            +
                    expect( result ).to match_array( [ @t1, @t2, @t3, @t4, @t5, @t6, @t7 ] )
         
     | 
| 
      
 557 
     | 
    
         
            +
                  end
         
     | 
| 
       396 
558 
     | 
    
         
             
                end
         
     | 
| 
       397 
559 
     | 
    
         | 
| 
       398 
     | 
    
         
            -
                 
     | 
| 
       399 
     | 
    
         
            -
                  result = find( described_class.ciaw_match_postgres.call( 'field', 'hello' ) )
         
     | 
| 
       400 
     | 
    
         
            -
                  expect( result ).to match_array( [ @f2, @f3, @f4 ] )
         
     | 
| 
      
 560 
     | 
    
         
            +
                ###########################################################################
         
     | 
| 
       401 
561 
     | 
    
         | 
| 
       402 
     | 
    
         
            -
             
     | 
| 
       403 
     | 
    
         
            -
                   
     | 
| 
      
 562 
     | 
    
         
            +
                context '#cs_gt' do
         
     | 
| 
      
 563 
     | 
    
         
            +
                  it 'generates expected no-input-parameter output' do
         
     | 
| 
      
 564 
     | 
    
         
            +
                    result = described_class.cs_gt()
         
     | 
| 
      
 565 
     | 
    
         
            +
                    expect( result.call( 'a', 'b' ) ).to eq( [ 'a > ? AND a IS NOT NULL', 'b' ] )
         
     | 
| 
      
 566 
     | 
    
         
            +
                  end
         
     | 
| 
      
 567 
     | 
    
         
            +
             
     | 
| 
      
 568 
     | 
    
         
            +
                  it 'generates expected one-input-parameter output' do
         
     | 
| 
      
 569 
     | 
    
         
            +
                    result = described_class.cs_gt( :bar )
         
     | 
| 
      
 570 
     | 
    
         
            +
                    expect( result.call( 'a', 'b' ) ).to eq( [ 'bar > ? AND bar IS NOT NULL', 'b' ] )
         
     | 
| 
      
 571 
     | 
    
         
            +
                  end
         
     | 
| 
      
 572 
     | 
    
         
            +
             
     | 
| 
      
 573 
     | 
    
         
            +
                  it 'finds expected things' do
         
     | 
| 
      
 574 
     | 
    
         
            +
                    result = find( described_class.cs_gt.call( 'created_at', @tn ) )
         
     | 
| 
      
 575 
     | 
    
         
            +
                    expect( result ).to match_array( [] )
         
     | 
| 
      
 576 
     | 
    
         
            +
             
     | 
| 
      
 577 
     | 
    
         
            +
                    result = find( described_class.cs_gt.call( 'created_at', ( @tn - 2.months ) ) )
         
     | 
| 
      
 578 
     | 
    
         
            +
                    expect( result ).to match_array( [ @t1, @t2, @t3, @t4 ] )
         
     | 
| 
      
 579 
     | 
    
         
            +
             
     | 
| 
      
 580 
     | 
    
         
            +
                    result = find( described_class.cs_gt.call( 'created_at', ( @tn - 1.month ) ) )
         
     | 
| 
      
 581 
     | 
    
         
            +
                    expect( result ).to match_array( [ @t1, @t2 ] )
         
     | 
| 
      
 582 
     | 
    
         
            +
             
     | 
| 
      
 583 
     | 
    
         
            +
                    result = find( described_class.cs_gt.call( 'created_at', ( @tn - 1.year ) ) )
         
     | 
| 
      
 584 
     | 
    
         
            +
                    expect( result ).to match_array( [ @t1, @t2, @t3, @t4 ] )
         
     | 
| 
      
 585 
     | 
    
         
            +
             
     | 
| 
      
 586 
     | 
    
         
            +
                    result = find( described_class.cs_gt.call( 'created_at', ( @tn - 2.years ) ) )
         
     | 
| 
      
 587 
     | 
    
         
            +
                    expect( result ).to match_array( [ @t1, @t2, @t3, @t4, @t5, @t6 ] )
         
     | 
| 
      
 588 
     | 
    
         
            +
                  end
         
     | 
| 
       404 
589 
     | 
    
         | 
| 
       405 
     | 
    
         
            -
                   
     | 
| 
       406 
     | 
    
         
            -
             
     | 
| 
      
 590 
     | 
    
         
            +
                  it 'finds expected things negated' do
         
     | 
| 
      
 591 
     | 
    
         
            +
                    result = find_not( described_class.cs_gt.call( 'created_at', @tn ) )
         
     | 
| 
      
 592 
     | 
    
         
            +
                    expect( result ).to match_array( [ @t1, @t2, @t3, @t4, @t5, @t6, @t7 ] )
         
     | 
| 
       407 
593 
     | 
    
         | 
| 
       408 
     | 
    
         
            -
             
     | 
| 
       409 
     | 
    
         
            -
             
     | 
| 
      
 594 
     | 
    
         
            +
                    result = find_not( described_class.cs_gt.call( 'created_at', ( @tn - 2.months ) ) )
         
     | 
| 
      
 595 
     | 
    
         
            +
                    expect( result ).to match_array( [ @t5, @t6, @t7 ] )
         
     | 
| 
       410 
596 
     | 
    
         | 
| 
       411 
     | 
    
         
            -
             
     | 
| 
       412 
     | 
    
         
            -
             
     | 
| 
      
 597 
     | 
    
         
            +
                    result = find_not( described_class.cs_gt.call( 'created_at', ( @tn - 1.month ) ) )
         
     | 
| 
      
 598 
     | 
    
         
            +
                    expect( result ).to match_array( [ @t3, @t4, @t5, @t6, @t7 ] )
         
     | 
| 
      
 599 
     | 
    
         
            +
             
     | 
| 
      
 600 
     | 
    
         
            +
                    result = find_not( described_class.cs_gt.call( 'created_at', ( @tn - 1.year ) ) )
         
     | 
| 
      
 601 
     | 
    
         
            +
                    expect( result ).to match_array( [ @t5, @t6, @t7 ] )
         
     | 
| 
      
 602 
     | 
    
         
            +
             
     | 
| 
      
 603 
     | 
    
         
            +
                    result = find_not( described_class.cs_gt.call( 'created_at', ( @tn - 2.years ) ) )
         
     | 
| 
      
 604 
     | 
    
         
            +
                    expect( result ).to match_array( [ @t7 ] )
         
     | 
| 
      
 605 
     | 
    
         
            +
                  end
         
     | 
| 
       413 
606 
     | 
    
         
             
                end
         
     | 
| 
       414 
607 
     | 
    
         | 
| 
       415 
     | 
    
         
            -
                 
     | 
| 
       416 
     | 
    
         
            -
                  result = find_not( described_class.ciaw_match_postgres.call( 'field', 'hello' ) )
         
     | 
| 
       417 
     | 
    
         
            -
                  expect( result ).to match_array( [ @f1, @f5, @f6, @f7, @f8 ] )
         
     | 
| 
      
 608 
     | 
    
         
            +
                ###########################################################################
         
     | 
| 
       418 
609 
     | 
    
         | 
| 
       419 
     | 
    
         
            -
             
     | 
| 
       420 
     | 
    
         
            -
                   
     | 
| 
      
 610 
     | 
    
         
            +
                context '#cs_gte' do
         
     | 
| 
      
 611 
     | 
    
         
            +
                  it 'generates expected no-input-parameter output' do
         
     | 
| 
      
 612 
     | 
    
         
            +
                    result = described_class.cs_gte()
         
     | 
| 
      
 613 
     | 
    
         
            +
                    expect( result.call( 'a', 'b' ) ).to eq( [ 'a >= ? AND a IS NOT NULL', 'b' ] )
         
     | 
| 
      
 614 
     | 
    
         
            +
                  end
         
     | 
| 
       421 
615 
     | 
    
         | 
| 
       422 
     | 
    
         
            -
                   
     | 
| 
       423 
     | 
    
         
            -
             
     | 
| 
      
 616 
     | 
    
         
            +
                  it 'generates expected one-input-parameter output' do
         
     | 
| 
      
 617 
     | 
    
         
            +
                    result = described_class.cs_gte( :bar )
         
     | 
| 
      
 618 
     | 
    
         
            +
                    expect( result.call( 'a', 'b' ) ).to eq( [ 'bar >= ? AND bar IS NOT NULL', 'b' ] )
         
     | 
| 
      
 619 
     | 
    
         
            +
                  end
         
     | 
| 
       424 
620 
     | 
    
         | 
| 
       425 
     | 
    
         
            -
                   
     | 
| 
       426 
     | 
    
         
            -
             
     | 
| 
      
 621 
     | 
    
         
            +
                  it 'finds expected things' do
         
     | 
| 
      
 622 
     | 
    
         
            +
                    result = find( described_class.cs_gte.call( 'created_at', @tn ) )
         
     | 
| 
      
 623 
     | 
    
         
            +
                    expect( result ).to match_array( [ @t1, @t2 ] )
         
     | 
| 
       427 
624 
     | 
    
         | 
| 
       428 
     | 
    
         
            -
             
     | 
| 
       429 
     | 
    
         
            -
             
     | 
| 
      
 625 
     | 
    
         
            +
                    result = find( described_class.cs_gte.call( 'created_at', ( @tn - 2.months ) ) )
         
     | 
| 
      
 626 
     | 
    
         
            +
                    expect( result ).to match_array( [ @t1, @t2, @t3, @t4 ] )
         
     | 
| 
      
 627 
     | 
    
         
            +
             
     | 
| 
      
 628 
     | 
    
         
            +
                    result = find( described_class.cs_gte.call( 'created_at', ( @tn - 1.month ) ) )
         
     | 
| 
      
 629 
     | 
    
         
            +
                    expect( result ).to match_array( [ @t1, @t2, @t3, @t4 ] )
         
     | 
| 
      
 630 
     | 
    
         
            +
             
     | 
| 
      
 631 
     | 
    
         
            +
                    result = find( described_class.cs_gte.call( 'created_at', ( @tn - 1.year ) ) )
         
     | 
| 
      
 632 
     | 
    
         
            +
                    expect( result ).to match_array( [ @t1, @t2, @t3, @t4, @t5, @t6 ] )
         
     | 
| 
      
 633 
     | 
    
         
            +
             
     | 
| 
      
 634 
     | 
    
         
            +
                    result = find( described_class.cs_gte.call( 'created_at', ( @tn - 2.years ) ) )
         
     | 
| 
      
 635 
     | 
    
         
            +
                    expect( result ).to match_array( [ @t1, @t2, @t3, @t4, @t5, @t6 ] )
         
     | 
| 
      
 636 
     | 
    
         
            +
                  end
         
     | 
| 
      
 637 
     | 
    
         
            +
             
     | 
| 
      
 638 
     | 
    
         
            +
                  it 'finds expected things negated' do
         
     | 
| 
      
 639 
     | 
    
         
            +
                    result = find_not( described_class.cs_gte.call( 'created_at', @tn ) )
         
     | 
| 
      
 640 
     | 
    
         
            +
                    expect( result ).to match_array( [ @t3, @t4, @t5, @t6, @t7 ] )
         
     | 
| 
      
 641 
     | 
    
         
            +
             
     | 
| 
      
 642 
     | 
    
         
            +
                    result = find_not( described_class.cs_gte.call( 'created_at', ( @tn - 2.months ) ) )
         
     | 
| 
      
 643 
     | 
    
         
            +
                    expect( result ).to match_array( [ @t5, @t6, @t7 ] )
         
     | 
| 
      
 644 
     | 
    
         
            +
             
     | 
| 
      
 645 
     | 
    
         
            +
                    result = find_not( described_class.cs_gte.call( 'created_at', ( @tn - 1.month ) ) )
         
     | 
| 
      
 646 
     | 
    
         
            +
                    expect( result ).to match_array( [ @t5, @t6, @t7 ] )
         
     | 
| 
      
 647 
     | 
    
         
            +
             
     | 
| 
      
 648 
     | 
    
         
            +
                    result = find_not( described_class.cs_gte.call( 'created_at', ( @tn - 1.year ) ) )
         
     | 
| 
      
 649 
     | 
    
         
            +
                    expect( result ).to match_array( [ @t7 ] )
         
     | 
| 
      
 650 
     | 
    
         
            +
             
     | 
| 
      
 651 
     | 
    
         
            +
                    result = find_not( described_class.cs_gte.call( 'created_at', ( @tn - 2.years ) ) )
         
     | 
| 
      
 652 
     | 
    
         
            +
                    expect( result ).to match_array( [ @t7 ] )
         
     | 
| 
      
 653 
     | 
    
         
            +
                  end
         
     | 
| 
       430 
654 
     | 
    
         
             
                end
         
     | 
| 
      
 655 
     | 
    
         
            +
             
     | 
| 
      
 656 
     | 
    
         
            +
                ###########################################################################
         
     | 
| 
      
 657 
     | 
    
         
            +
             
     | 
| 
       431 
658 
     | 
    
         
             
              end
         
     | 
| 
       432 
659 
     | 
    
         
             
            end
         
     |