with_filters 0.1.1 → 0.1.2
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.
- data/changelog.md +3 -0
 - data/lib/with_filters/active_record_model_extension.rb +1 -1
 - data/lib/with_filters/models/filter/base_range.rb +2 -2
 - data/lib/with_filters/models/filter_form.rb +2 -2
 - data/lib/with_filters/value_prep/default_prep.rb +1 -1
 - data/lib/with_filters/version.rb +1 -1
 - data/spec/active_record_model_extension_spec.rb +38 -38
 - data/spec/helpers/action_view_extension_spec.rb +3 -3
 - data/spec/value_prep/date_prep_spec.rb +1 -1
 - data/spec/value_prep/date_time_prep_spec.rb +15 -15
 - metadata +13 -13
 
    
        data/changelog.md
    CHANGED
    
    
| 
         @@ -74,7 +74,7 @@ module WithFilters 
     | 
|
| 
       74 
74 
     | 
    
         
             
                      value.reject!{|v| v.blank?} if value.is_a?(Array)
         
     | 
| 
       75 
75 
     | 
    
         
             
                      if (value.is_a?(String) and value.blank?) or
         
     | 
| 
       76 
76 
     | 
    
         
             
                         (value.is_a?(Array) and value.empty?) or
         
     | 
| 
       77 
     | 
    
         
            -
                         (value.is_a?(Hash) and not (value[ 
     | 
| 
      
 77 
     | 
    
         
            +
                         (value.is_a?(Hash) and not (value['start'].present? and value['stop'].present?))
         
     | 
| 
       78 
78 
     | 
    
         
             
                        next
         
     | 
| 
       79 
79 
     | 
    
         
             
                      end
         
     | 
| 
       80 
80 
     | 
    
         | 
| 
         @@ -34,8 +34,8 @@ module WithFilters 
     | 
|
| 
       34 
34 
     | 
    
         
             
                    stop_attrs.reverse_merge!(label: self.label, label_attrs: self.label_attrs, collection: @collection)
         
     | 
| 
       35 
35 
     | 
    
         | 
| 
       36 
36 
     | 
    
         
             
                    base_class_name = self.class.to_s.match(/^(.*)Range$/).captures.first
         
     | 
| 
       37 
     | 
    
         
            -
                    @start = "#{base_class_name}Start".constantize.new(name, namespace, value[ 
     | 
| 
       38 
     | 
    
         
            -
                    @stop  = "#{base_class_name}Stop".constantize.new(name, namespace, value[ 
     | 
| 
      
 37 
     | 
    
         
            +
                    @start = "#{base_class_name}Start".constantize.new(name, namespace, value['start'], start_attrs)
         
     | 
| 
      
 38 
     | 
    
         
            +
                    @stop  = "#{base_class_name}Stop".constantize.new(name, namespace, value['stop'], stop_attrs)
         
     | 
| 
       39 
39 
     | 
    
         
             
                  end
         
     | 
| 
       40 
40 
     | 
    
         
             
                end
         
     | 
| 
       41 
41 
     | 
    
         
             
              end
         
     | 
| 
         @@ -37,7 +37,7 @@ module WithFilters 
     | 
|
| 
       37 
37 
     | 
    
         
             
                  options.merge!(theme: @theme)
         
     | 
| 
       38 
38 
     | 
    
         
             
                  as = options[:as]
         
     | 
| 
       39 
39 
     | 
    
         | 
| 
       40 
     | 
    
         
            -
                  filter = WithFilters::Filter.create(name, self.param_namespace, @values[name], options)
         
     | 
| 
      
 40 
     | 
    
         
            +
                  filter = WithFilters::Filter.create(name, self.param_namespace, @values[name.to_s], options)
         
     | 
| 
       41 
41 
     | 
    
         | 
| 
       42 
42 
     | 
    
         
             
                  (as == :hidden ? @hidden_filters : @filters).push(filter)
         
     | 
| 
       43 
43 
     | 
    
         
             
                end
         
     | 
| 
         @@ -50,7 +50,7 @@ module WithFilters 
     | 
|
| 
       50 
50 
     | 
    
         
             
                  options[:as] = find_as(name, options[:collection]) unless options[:as]
         
     | 
| 
       51 
51 
     | 
    
         
             
                  options.merge!(theme: @theme)
         
     | 
| 
       52 
52 
     | 
    
         | 
| 
       53 
     | 
    
         
            -
                  @filters.push(WithFilters::Filter.create_range(name, self.param_namespace, @values[name] || {}, options))
         
     | 
| 
      
 53 
     | 
    
         
            +
                  @filters.push(WithFilters::Filter.create_range(name, self.param_namespace, @values[name.to_s] || {}, options))
         
     | 
| 
       54 
54 
     | 
    
         
             
                end
         
     | 
| 
       55 
55 
     | 
    
         | 
| 
       56 
56 
     | 
    
         
             
                # @param [Symbol] type
         
     | 
| 
         @@ -20,7 +20,7 @@ module WithFilters 
     | 
|
| 
       20 
20 
     | 
    
         
             
                  # @since 0.1.0
         
     | 
| 
       21 
21 
     | 
    
         
             
                  def value
         
     | 
| 
       22 
22 
     | 
    
         
             
                    @prepared_value ||= if @value.is_a?(Hash)
         
     | 
| 
       23 
     | 
    
         
            -
                      {start: prepare_start_value(@value[ 
     | 
| 
      
 23 
     | 
    
         
            +
                      {start: prepare_start_value(@value['start']), stop: prepare_stop_value(@value['stop'])}
         
     | 
| 
       24 
24 
     | 
    
         
             
                    else
         
     | 
| 
       25 
25 
     | 
    
         
             
                      temp = Array.wrap(@value).map do |value|
         
     | 
| 
       26 
26 
     | 
    
         
             
                        add_match(prepare_value(value))
         
     | 
    
        data/lib/with_filters/version.rb
    CHANGED
    
    
| 
         @@ -5,27 +5,27 @@ describe 'WithFilters::ActiveRecordModelExtention' do 
     | 
|
| 
       5 
5 
     | 
    
         
             
                context 'filters using fields' do
         
     | 
| 
       6 
6 
     | 
    
         
             
                  context 'where value is a string' do
         
     | 
| 
       7 
7 
     | 
    
         
             
                    it 'filters based on the string value' do
         
     | 
| 
       8 
     | 
    
         
            -
                      npw = NobelPrizeWinner.with_filters({nobel_prize_winners 
     | 
| 
      
 8 
     | 
    
         
            +
                      npw = NobelPrizeWinner.with_filters({'nobel_prize_winners' => {'first_name' => 'Albert'}})
         
     | 
| 
       9 
9 
     | 
    
         
             
                      npw.length.should == 1
         
     | 
| 
       10 
10 
     | 
    
         
             
                      npw.first.first_name.should == 'Albert'
         
     | 
| 
       11 
11 
     | 
    
         
             
                    end
         
     | 
| 
       12 
12 
     | 
    
         | 
| 
       13 
13 
     | 
    
         
             
                    it 'skips an empty value' do
         
     | 
| 
       14 
     | 
    
         
            -
                      npw = NobelPrizeWinner.with_filters({nobel_prize_winners 
     | 
| 
      
 14 
     | 
    
         
            +
                      npw = NobelPrizeWinner.with_filters({'nobel_prize_winners' => {'first_name' => ''}})
         
     | 
| 
       15 
15 
     | 
    
         
             
                      npw.where_values.should == []
         
     | 
| 
       16 
16 
     | 
    
         
             
                    end
         
     | 
| 
       17 
17 
     | 
    
         
             
                  end
         
     | 
| 
       18 
18 
     | 
    
         | 
| 
       19 
19 
     | 
    
         
             
                  context 'where value is an array' do
         
     | 
| 
       20 
20 
     | 
    
         
             
                    it 'filters based on the array values' do
         
     | 
| 
       21 
     | 
    
         
            -
                      npw = NobelPrizeWinner.with_filters({nobel_prize_winners 
     | 
| 
      
 21 
     | 
    
         
            +
                      npw = NobelPrizeWinner.with_filters({'nobel_prize_winners' => {'first_name' => ['Albert', 'Marie']}}).order('first_name ASC')
         
     | 
| 
       22 
22 
     | 
    
         
             
                      npw.length.should == 2
         
     | 
| 
       23 
23 
     | 
    
         
             
                      npw.first.first_name.should == 'Albert'
         
     | 
| 
       24 
24 
     | 
    
         
             
                      npw.last.first_name.should == 'Marie'
         
     | 
| 
       25 
25 
     | 
    
         
             
                    end
         
     | 
| 
       26 
26 
     | 
    
         | 
| 
       27 
27 
     | 
    
         
             
                    it 'skips blank array values' do
         
     | 
| 
       28 
     | 
    
         
            -
                      npw = NobelPrizeWinner.with_filters({nobel_prize_winners 
     | 
| 
      
 28 
     | 
    
         
            +
                      npw = NobelPrizeWinner.with_filters({'nobel_prize_winners' => {'first_name' => ['Albert', 'Marie', '']}}).order('first_name ASC')
         
     | 
| 
       29 
29 
     | 
    
         
             
                      npw.length.should == 2
         
     | 
| 
       30 
30 
     | 
    
         
             
                      npw.first.first_name.should == 'Albert'
         
     | 
| 
       31 
31 
     | 
    
         
             
                      npw.last.first_name.should == 'Marie'
         
     | 
| 
         @@ -33,32 +33,32 @@ describe 'WithFilters::ActiveRecordModelExtention' do 
     | 
|
| 
       33 
33 
     | 
    
         
             
                    end
         
     | 
| 
       34 
34 
     | 
    
         | 
| 
       35 
35 
     | 
    
         
             
                    it 'skips empty arrays' do
         
     | 
| 
       36 
     | 
    
         
            -
                      npw = NobelPrizeWinner.with_filters({nobel_prize_winners 
     | 
| 
      
 36 
     | 
    
         
            +
                      npw = NobelPrizeWinner.with_filters({'nobel_prize_winners' => {'first_name' => []}})
         
     | 
| 
       37 
37 
     | 
    
         
             
                      npw.where_values.should == []
         
     | 
| 
       38 
38 
     | 
    
         
             
                    end
         
     | 
| 
       39 
39 
     | 
    
         
             
                  end
         
     | 
| 
       40 
40 
     | 
    
         | 
| 
       41 
41 
     | 
    
         
             
                  context 'where value is a :start and :stop range' do
         
     | 
| 
       42 
42 
     | 
    
         
             
                    it 'filters between :start and :stop' do
         
     | 
| 
       43 
     | 
    
         
            -
                      np = NobelPrize.with_filters({nobel_prizes 
     | 
| 
      
 43 
     | 
    
         
            +
                      np = NobelPrize.with_filters({'nobel_prizes' => {'year' => {'start' => 1900, 'stop' => 1930}}})
         
     | 
| 
       44 
44 
     | 
    
         
             
                      np.length.should == 4
         
     | 
| 
       45 
45 
     | 
    
         
             
                    end
         
     | 
| 
       46 
46 
     | 
    
         | 
| 
       47 
47 
     | 
    
         
             
                    it 'discards the range if :start or :stop are empty' do
         
     | 
| 
       48 
     | 
    
         
            -
                      np = NobelPrize.with_filters({nobel_prizes 
     | 
| 
      
 48 
     | 
    
         
            +
                      np = NobelPrize.with_filters({'nobel_prizes' => {'year' => {'start' => 1900, 'stop' => ''}}})
         
     | 
| 
       49 
49 
     | 
    
         
             
                      np.where_values.should == []
         
     | 
| 
       50 
50 
     | 
    
         | 
| 
       51 
     | 
    
         
            -
                      np = NobelPrize.with_filters({nobel_prizes 
     | 
| 
      
 51 
     | 
    
         
            +
                      np = NobelPrize.with_filters({'nobel_prizes' => {'year' => {'stop' => 1930}}})
         
     | 
| 
       52 
52 
     | 
    
         
             
                      np.where_values.should == []
         
     | 
| 
       53 
53 
     | 
    
         
             
                    end
         
     | 
| 
       54 
54 
     | 
    
         
             
                  end
         
     | 
| 
       55 
55 
     | 
    
         | 
| 
       56 
56 
     | 
    
         
             
                  context 'where value is a boolean (and the column on the table is a :boolean)' do
         
     | 
| 
       57 
57 
     | 
    
         
             
                    it 'filters when "on" or "off" is passed' do
         
     | 
| 
       58 
     | 
    
         
            -
                      np = NobelPrize.with_filters({nobel_prizes 
     | 
| 
      
 58 
     | 
    
         
            +
                      np = NobelPrize.with_filters({'nobel_prizes' => {'shared' => 'on'}})
         
     | 
| 
       59 
59 
     | 
    
         
             
                      np.length.should == 7
         
     | 
| 
       60 
60 
     | 
    
         | 
| 
       61 
     | 
    
         
            -
                      np = NobelPrize.with_filters({nobel_prizes 
     | 
| 
      
 61 
     | 
    
         
            +
                      np = NobelPrize.with_filters({'nobel_prizes' => {'shared' => 'off'}})
         
     | 
| 
       62 
62 
     | 
    
         
             
                      np.length.should == 9
         
     | 
| 
       63 
63 
     | 
    
         
             
                    end
         
     | 
| 
       64 
64 
     | 
    
         
             
                  end
         
     | 
| 
         @@ -66,7 +66,7 @@ describe 'WithFilters::ActiveRecordModelExtention' do 
     | 
|
| 
       66 
66 
     | 
    
         
             
                  context 'where value is a date' do
         
     | 
| 
       67 
67 
     | 
    
         
             
                    context 'and the column on the table is a :date' do
         
     | 
| 
       68 
68 
     | 
    
         
             
                      it 'filters on the date value' do
         
     | 
| 
       69 
     | 
    
         
            -
                        npw = NobelPrizeWinner.with_filters({nobel_prize_winners 
     | 
| 
      
 69 
     | 
    
         
            +
                        npw = NobelPrizeWinner.with_filters({'nobel_prize_winners' => {'birthdate' => '19140325'}})
         
     | 
| 
       70 
70 
     | 
    
         
             
                        npw.length.should == 1
         
     | 
| 
       71 
71 
     | 
    
         
             
                        npw.first.birthdate.should == '19140325'.to_date
         
     | 
| 
       72 
72 
     | 
    
         
             
                      end
         
     | 
| 
         @@ -75,7 +75,7 @@ describe 'WithFilters::ActiveRecordModelExtention' do 
     | 
|
| 
       75 
75 
     | 
    
         
             
                    context 'and the column on the table is a :datetime or :timestamp' do
         
     | 
| 
       76 
76 
     | 
    
         
             
                      it 'filters on the date value' do
         
     | 
| 
       77 
77 
     | 
    
         
             
                        date = '2012-01-01'
         
     | 
| 
       78 
     | 
    
         
            -
                        ddt = DateTimeTester.with_filters({date_time_testers 
     | 
| 
      
 78 
     | 
    
         
            +
                        ddt = DateTimeTester.with_filters({'date_time_testers' => {'test' => date}}).order('test ASC')
         
     | 
| 
       79 
79 
     | 
    
         
             
                        ddt.length.should == 8
         
     | 
| 
       80 
80 
     | 
    
         
             
                        ddt.first.test.to_s.should =~ /^#{date}/
         
     | 
| 
       81 
81 
     | 
    
         
             
                        ddt.last.test.to_s.should =~ /^#{date}/
         
     | 
| 
         @@ -89,7 +89,7 @@ describe 'WithFilters::ActiveRecordModelExtention' do 
     | 
|
| 
       89 
89 
     | 
    
         
             
                        start_date = '1914-03-25'
         
     | 
| 
       90 
90 
     | 
    
         
             
                        stop_date  = '1928-04-06'
         
     | 
| 
       91 
91 
     | 
    
         
             
                        npw = NobelPrizeWinner.
         
     | 
| 
       92 
     | 
    
         
            -
                          with_filters({nobel_prize_winners 
     | 
| 
      
 92 
     | 
    
         
            +
                          with_filters({'nobel_prize_winners' => {'birthdate' => {'start' => start_date, 'stop' => stop_date}}}).
         
     | 
| 
       93 
93 
     | 
    
         
             
                          order('birthdate ASC')
         
     | 
| 
       94 
94 
     | 
    
         
             
                        npw.length.should == 4
         
     | 
| 
       95 
95 
     | 
    
         
             
                        npw.first.birthdate.should == start_date.to_date
         
     | 
| 
         @@ -102,7 +102,7 @@ describe 'WithFilters::ActiveRecordModelExtention' do 
     | 
|
| 
       102 
102 
     | 
    
         
             
                        start_date = '2012-01-01'
         
     | 
| 
       103 
103 
     | 
    
         
             
                        stop_date  = '2012-01-01'
         
     | 
| 
       104 
104 
     | 
    
         
             
                        ddt = DateTimeTester.
         
     | 
| 
       105 
     | 
    
         
            -
                          with_filters({date_time_testers 
     | 
| 
      
 105 
     | 
    
         
            +
                          with_filters({'date_time_testers' => {'test' => {'start' => start_date, 'stop' => stop_date}}}).
         
     | 
| 
       106 
106 
     | 
    
         
             
                          order('test ASC')
         
     | 
| 
       107 
107 
     | 
    
         
             
                        ddt.length.should == 8
         
     | 
| 
       108 
108 
     | 
    
         
             
                        ddt.first.test.to_s.should =~ /^#{start_date}/
         
     | 
| 
         @@ -114,7 +114,7 @@ describe 'WithFilters::ActiveRecordModelExtention' do 
     | 
|
| 
       114 
114 
     | 
    
         
             
                  context 'where value is a datetime with microseconds (and the column on the table is a :datetime or :timestamp)' do
         
     | 
| 
       115 
115 
     | 
    
         
             
                    it 'filters on the datetime value' do
         
     | 
| 
       116 
116 
     | 
    
         
             
                      time = '2012-01-01 00:00:01.654321'
         
     | 
| 
       117 
     | 
    
         
            -
                      ddt = DateTimeTester.with_filters({date_time_testers 
     | 
| 
      
 117 
     | 
    
         
            +
                      ddt = DateTimeTester.with_filters({'date_time_testers' => {'test' => time}})
         
     | 
| 
       118 
118 
     | 
    
         
             
                      ddt.length.should == 1
         
     | 
| 
       119 
119 
     | 
    
         
             
                      ddt.first.test.to_s.should == Time.parse(time).to_s
         
     | 
| 
       120 
120 
     | 
    
         
             
                    end
         
     | 
| 
         @@ -123,7 +123,7 @@ describe 'WithFilters::ActiveRecordModelExtention' do 
     | 
|
| 
       123 
123 
     | 
    
         
             
                  context 'where value is a datetime (and the column on the table is a :datetime or :timestamp)' do
         
     | 
| 
       124 
124 
     | 
    
         
             
                    it 'filters on the datetime value' do
         
     | 
| 
       125 
125 
     | 
    
         
             
                      time = '2012-01-01 00:00:01'
         
     | 
| 
       126 
     | 
    
         
            -
                      ddt = DateTimeTester.with_filters({date_time_testers 
     | 
| 
      
 126 
     | 
    
         
            +
                      ddt = DateTimeTester.with_filters({'date_time_testers' => {'test' => time}}).order('test ASC')
         
     | 
| 
       127 
127 
     | 
    
         
             
                      ddt.length.should == 4
         
     | 
| 
       128 
128 
     | 
    
         
             
                      ddt.map(&:test).each do |test|
         
     | 
| 
       129 
129 
     | 
    
         
             
                        test.to_s.should =~ /^#{time}/
         
     | 
| 
         @@ -136,7 +136,7 @@ describe 'WithFilters::ActiveRecordModelExtention' do 
     | 
|
| 
       136 
136 
     | 
    
         
             
                      start_time = '2012-01-01 00:00:01.123456'
         
     | 
| 
       137 
137 
     | 
    
         
             
                      stop_time  = '2012-01-01 00:00:01.654300'
         
     | 
| 
       138 
138 
     | 
    
         
             
                      ddt = DateTimeTester.
         
     | 
| 
       139 
     | 
    
         
            -
                        with_filters({date_time_testers 
     | 
| 
      
 139 
     | 
    
         
            +
                        with_filters({'date_time_testers' => {'test' => {'start' => start_time, 'stop' => stop_time}}}).
         
     | 
| 
       140 
140 
     | 
    
         
             
                        order('test ASC')
         
     | 
| 
       141 
141 
     | 
    
         
             
                      ddt.length.should == 2
         
     | 
| 
       142 
142 
     | 
    
         
             
                      ddt.first.test.to_s.should == Time.parse(start_time).to_s
         
     | 
| 
         @@ -149,7 +149,7 @@ describe 'WithFilters::ActiveRecordModelExtention' do 
     | 
|
| 
       149 
149 
     | 
    
         
             
                      start_time = '2012-01-01 00:00:01'
         
     | 
| 
       150 
150 
     | 
    
         
             
                      stop_time  = '2012-01-01 00:00:02'
         
     | 
| 
       151 
151 
     | 
    
         
             
                      ddt = DateTimeTester.
         
     | 
| 
       152 
     | 
    
         
            -
                        with_filters({date_time_testers 
     | 
| 
      
 152 
     | 
    
         
            +
                        with_filters({'date_time_testers' => {'test' => {'start' => start_time, 'stop' => stop_time}}}).
         
     | 
| 
       153 
153 
     | 
    
         
             
                        order('test ASC')
         
     | 
| 
       154 
154 
     | 
    
         
             
                      ddt.length.should == 5
         
     | 
| 
       155 
155 
     | 
    
         
             
                      ddt.first.test.to_s.should =~ /^#{start_time}/
         
     | 
| 
         @@ -158,7 +158,7 @@ describe 'WithFilters::ActiveRecordModelExtention' do 
     | 
|
| 
       158 
158 
     | 
    
         
             
                  end
         
     | 
| 
       159 
159 
     | 
    
         | 
| 
       160 
160 
     | 
    
         
             
                  it 'accepts more than one field' do
         
     | 
| 
       161 
     | 
    
         
            -
                    np = NobelPrize.with_filters({nobel_prizes 
     | 
| 
      
 161 
     | 
    
         
            +
                    np = NobelPrize.with_filters({'nobel_prizes' => {'year' => {'start' => 1900, 'stop' => 1930}, 'category' => 'Physics'}})
         
     | 
| 
       162 
162 
     | 
    
         
             
                    np.length.should == 3
         
     | 
| 
       163 
163 
     | 
    
         
             
                  end
         
     | 
| 
       164 
164 
     | 
    
         
             
                end
         
     | 
| 
         @@ -166,13 +166,13 @@ describe 'WithFilters::ActiveRecordModelExtention' do 
     | 
|
| 
       166 
166 
     | 
    
         
             
                context 'options' do
         
     | 
| 
       167 
167 
     | 
    
         
             
                  context ':param_namespace' do
         
     | 
| 
       168 
168 
     | 
    
         
             
                    it 'finds the params from the hash using the namespace' do
         
     | 
| 
       169 
     | 
    
         
            -
                      npw = NobelPrizeWinner.with_filters({foo 
     | 
| 
      
 169 
     | 
    
         
            +
                      npw = NobelPrizeWinner.with_filters({'foo' => {'first_name' => 'Albert'}}, {param_namespace: :foo})
         
     | 
| 
       170 
170 
     | 
    
         
             
                      npw.with_filters_data[:param_namespace].should == :foo
         
     | 
| 
       171 
171 
     | 
    
         
             
                    end 
         
     | 
| 
       172 
172 
     | 
    
         
             
                  end
         
     | 
| 
       173 
173 
     | 
    
         
             
                  context 'no :param_namespace' do
         
     | 
| 
       174 
174 
     | 
    
         
             
                    it 'defaults to the primary table name' do
         
     | 
| 
       175 
     | 
    
         
            -
                      npw = NobelPrizeWinner.with_filters({nobel_prize_winners 
     | 
| 
      
 175 
     | 
    
         
            +
                      npw = NobelPrizeWinner.with_filters({'nobel_prize_winners' => {'first_name' => 'Albert'}})
         
     | 
| 
       176 
176 
     | 
    
         
             
                      npw.with_filters_data[:param_namespace].should == :nobel_prize_winners
         
     | 
| 
       177 
177 
     | 
    
         
             
                    end 
         
     | 
| 
       178 
178 
     | 
    
         
             
                  end
         
     | 
| 
         @@ -181,7 +181,7 @@ describe 'WithFilters::ActiveRecordModelExtention' do 
     | 
|
| 
       181 
181 
     | 
    
         
             
                    context 'value is a hash of options' do
         
     | 
| 
       182 
182 
     | 
    
         
             
                      context ':column' do
         
     | 
| 
       183 
183 
     | 
    
         
             
                        it 'uses the passed column name' do
         
     | 
| 
       184 
     | 
    
         
            -
                          npw = NobelPrizeWinner.with_filters({nobel_prize_winners 
     | 
| 
      
 184 
     | 
    
         
            +
                          npw = NobelPrizeWinner.with_filters({'nobel_prize_winners' => {'fname' =>  'Albert'}}, {
         
     | 
| 
       185 
185 
     | 
    
         
             
                            fields: {
         
     | 
| 
       186 
186 
     | 
    
         
             
                              fname: {column: :first_name}
         
     | 
| 
       187 
187 
     | 
    
         
             
                            }
         
     | 
| 
         @@ -189,7 +189,7 @@ describe 'WithFilters::ActiveRecordModelExtention' do 
     | 
|
| 
       189 
189 
     | 
    
         
             
                          npw.length.should == 1
         
     | 
| 
       190 
190 
     | 
    
         
             
                          npw.first.first_name.should == 'Albert'
         
     | 
| 
       191 
191 
     | 
    
         | 
| 
       192 
     | 
    
         
            -
                          npw = NobelPrizeWinner.with_filters({nobel_prize_winners 
     | 
| 
      
 192 
     | 
    
         
            +
                          npw = NobelPrizeWinner.with_filters({'nobel_prize_winners' => {'fname' => 'Albert'}}, {
         
     | 
| 
       193 
193 
     | 
    
         
             
                            fields: {
         
     | 
| 
       194 
194 
     | 
    
         
             
                              fname: {column: 'nobel_prize_winners.first_name'}
         
     | 
| 
       195 
195 
     | 
    
         
             
                            }
         
     | 
| 
         @@ -203,7 +203,7 @@ describe 'WithFilters::ActiveRecordModelExtention' do 
     | 
|
| 
       203 
203 
     | 
    
         
             
                        context ':exact' do
         
     | 
| 
       204 
204 
     | 
    
         
             
                          it 'handles matches for a single entry' do
         
     | 
| 
       205 
205 
     | 
    
         
             
                            npw = NobelPrizeWinner.with_filters(
         
     | 
| 
       206 
     | 
    
         
            -
                              {nobel_prize_winners 
     | 
| 
      
 206 
     | 
    
         
            +
                              {'nobel_prize_winners' => {'first_name' => 'Paul'}},
         
     | 
| 
       207 
207 
     | 
    
         
             
                              {fields: {
         
     | 
| 
       208 
208 
     | 
    
         
             
                                first_name: {match: :exact}
         
     | 
| 
       209 
209 
     | 
    
         
             
                              }}
         
     | 
| 
         @@ -216,7 +216,7 @@ describe 'WithFilters::ActiveRecordModelExtention' do 
     | 
|
| 
       216 
216 
     | 
    
         | 
| 
       217 
217 
     | 
    
         
             
                          it 'handles matches for a multiple entries' do
         
     | 
| 
       218 
218 
     | 
    
         
             
                            npw = NobelPrizeWinner.with_filters(
         
     | 
| 
       219 
     | 
    
         
            -
                              {nobel_prize_winners 
     | 
| 
      
 219 
     | 
    
         
            +
                              {'nobel_prize_winners' => {'first_name' => ['Paul', 'Erwin']}},
         
     | 
| 
       220 
220 
     | 
    
         
             
                              {fields: {
         
     | 
| 
       221 
221 
     | 
    
         
             
                                first_name: {match: :exact}
         
     | 
| 
       222 
222 
     | 
    
         
             
                              }}
         
     | 
| 
         @@ -231,7 +231,7 @@ describe 'WithFilters::ActiveRecordModelExtention' do 
     | 
|
| 
       231 
231 
     | 
    
         
             
                        context ':contains' do
         
     | 
| 
       232 
232 
     | 
    
         
             
                          it 'handles matches for a single entry' do
         
     | 
| 
       233 
233 
     | 
    
         
             
                            npw = NobelPrizeWinner.with_filters(
         
     | 
| 
       234 
     | 
    
         
            -
                              {nobel_prize_winners 
     | 
| 
      
 234 
     | 
    
         
            +
                              {'nobel_prize_winners' => {'first_name' => 'el'}},
         
     | 
| 
       235 
235 
     | 
    
         
             
                              {fields: {
         
     | 
| 
       236 
236 
     | 
    
         
             
                                first_name: {match: :contains}
         
     | 
| 
       237 
237 
     | 
    
         
             
                              }}
         
     | 
| 
         @@ -244,7 +244,7 @@ describe 'WithFilters::ActiveRecordModelExtention' do 
     | 
|
| 
       244 
244 
     | 
    
         | 
| 
       245 
245 
     | 
    
         
             
                          it 'handles matches for a multiple entries' do
         
     | 
| 
       246 
246 
     | 
    
         
             
                            npw = NobelPrizeWinner.with_filters(
         
     | 
| 
       247 
     | 
    
         
            -
                              {nobel_prize_winners 
     | 
| 
      
 247 
     | 
    
         
            +
                              {'nobel_prize_winners' => {'first_name' => ['ert', 'mu'] }},
         
     | 
| 
       248 
248 
     | 
    
         
             
                              {fields: {
         
     | 
| 
       249 
249 
     | 
    
         
             
                                first_name: {match: :contains}
         
     | 
| 
       250 
250 
     | 
    
         
             
                              }}
         
     | 
| 
         @@ -259,7 +259,7 @@ describe 'WithFilters::ActiveRecordModelExtention' do 
     | 
|
| 
       259 
259 
     | 
    
         
             
                        context ':begins_with' do
         
     | 
| 
       260 
260 
     | 
    
         
             
                          it 'handles matches for a single entry' do
         
     | 
| 
       261 
261 
     | 
    
         
             
                            npw = NobelPrizeWinner.with_filters(
         
     | 
| 
       262 
     | 
    
         
            -
                              {nobel_prize_winners 
     | 
| 
      
 262 
     | 
    
         
            +
                              {'nobel_prize_winners' => {'first_name' => 'ja'}},
         
     | 
| 
       263 
263 
     | 
    
         
             
                              {fields: {
         
     | 
| 
       264 
264 
     | 
    
         
             
                                first_name: {match: :begins_with}
         
     | 
| 
       265 
265 
     | 
    
         
             
                              }}
         
     | 
| 
         @@ -271,7 +271,7 @@ describe 'WithFilters::ActiveRecordModelExtention' do 
     | 
|
| 
       271 
271 
     | 
    
         | 
| 
       272 
272 
     | 
    
         
             
                          it 'handles matches for a multiple entries' do
         
     | 
| 
       273 
273 
     | 
    
         
             
                            npw = NobelPrizeWinner.with_filters(
         
     | 
| 
       274 
     | 
    
         
            -
                              {nobel_prize_winners 
     | 
| 
      
 274 
     | 
    
         
            +
                              {'nobel_prize_winners' => {'first_name' => ['ja', 'ri']}},
         
     | 
| 
       275 
275 
     | 
    
         
             
                              {fields: {
         
     | 
| 
       276 
276 
     | 
    
         
             
                                first_name: {match: :begins_with}
         
     | 
| 
       277 
277 
     | 
    
         
             
                              }}
         
     | 
| 
         @@ -286,7 +286,7 @@ describe 'WithFilters::ActiveRecordModelExtention' do 
     | 
|
| 
       286 
286 
     | 
    
         
             
                        context ':ends_with' do
         
     | 
| 
       287 
287 
     | 
    
         
             
                          it 'handles matches for a single entry' do
         
     | 
| 
       288 
288 
     | 
    
         
             
                            npw = NobelPrizeWinner.with_filters(
         
     | 
| 
       289 
     | 
    
         
            -
                              {nobel_prize_winners 
     | 
| 
      
 289 
     | 
    
         
            +
                              {'nobel_prize_winners' => {'first_name' => 'es'}},
         
     | 
| 
       290 
290 
     | 
    
         
             
                              {fields: {
         
     | 
| 
       291 
291 
     | 
    
         
             
                                first_name: {match: :ends_with}
         
     | 
| 
       292 
292 
     | 
    
         
             
                              }}
         
     | 
| 
         @@ -298,7 +298,7 @@ describe 'WithFilters::ActiveRecordModelExtention' do 
     | 
|
| 
       298 
298 
     | 
    
         | 
| 
       299 
299 
     | 
    
         
             
                          it 'handles matches for a multiple entries' do
         
     | 
| 
       300 
300 
     | 
    
         
             
                            npw = NobelPrizeWinner.with_filters(
         
     | 
| 
       301 
     | 
    
         
            -
                              {nobel_prize_winners 
     | 
| 
      
 301 
     | 
    
         
            +
                              {'nobel_prize_winners' => {'first_name' => ['es', 'ie']}},
         
     | 
| 
       302 
302 
     | 
    
         
             
                              {fields: {
         
     | 
| 
       303 
303 
     | 
    
         
             
                                first_name: {match: :ends_with}
         
     | 
| 
       304 
304 
     | 
    
         
             
                              }}
         
     | 
| 
         @@ -315,7 +315,7 @@ describe 'WithFilters::ActiveRecordModelExtention' do 
     | 
|
| 
       315 
315 
     | 
    
         
             
                    context 'value is a Proc' do
         
     | 
| 
       316 
316 
     | 
    
         
             
                      it 'returns the value from the proc' do
         
     | 
| 
       317 
317 
     | 
    
         
             
                        npw = NobelPrizeWinner.with_filters(
         
     | 
| 
       318 
     | 
    
         
            -
                          {nobel_prize_winners 
     | 
| 
      
 318 
     | 
    
         
            +
                          {'nobel_prize_winners' => {'full_name' => 'Albert Einstein'}},
         
     | 
| 
       319 
319 
     | 
    
         
             
                          {fields: {
         
     | 
| 
       320 
320 
     | 
    
         
             
                            full_name: ->(value, scope) {
         
     | 
| 
       321 
321 
     | 
    
         
             
                              first_word, second_word = value.strip.split(/\s+/)
         
     | 
| 
         @@ -338,7 +338,7 @@ describe 'WithFilters::ActiveRecordModelExtention' do 
     | 
|
| 
       338 
338 
     | 
    
         | 
| 
       339 
339 
     | 
    
         
             
                context 'provides with_filters_data attr' do
         
     | 
| 
       340 
340 
     | 
    
         
             
                  it 'has :param_namespace' do
         
     | 
| 
       341 
     | 
    
         
            -
                    npw = NobelPrizeWinner.with_filters({nobel_prize_winners 
     | 
| 
      
 341 
     | 
    
         
            +
                    npw = NobelPrizeWinner.with_filters({'nobel_prize_winners' => {'first_name' => 'Albert'}})
         
     | 
| 
       342 
342 
     | 
    
         
             
                    npw.with_filters_data[:param_namespace].should == :nobel_prize_winners
         
     | 
| 
       343 
343 
     | 
    
         
             
                  end
         
     | 
| 
       344 
344 
     | 
    
         | 
| 
         @@ -361,7 +361,7 @@ describe 'WithFilters::ActiveRecordModelExtention' do 
     | 
|
| 
       361 
361 
     | 
    
         
             
                    it 'joins an association' do
         
     | 
| 
       362 
362 
     | 
    
         
             
                      npw = NobelPrizeWinner.
         
     | 
| 
       363 
363 
     | 
    
         
             
                        joins(:nobel_prizes).
         
     | 
| 
       364 
     | 
    
         
            -
                        with_filters({nobel_prize_winners 
     | 
| 
      
 364 
     | 
    
         
            +
                        with_filters({'nobel_prize_winners' => {'first_name' => 'Albert'}})
         
     | 
| 
       365 
365 
     | 
    
         | 
| 
       366 
366 
     | 
    
         
             
                      npw.with_filters_data[:column_types].should == column_types
         
     | 
| 
       367 
367 
     | 
    
         
             
                    end
         
     | 
| 
         @@ -397,7 +397,7 @@ describe 'WithFilters::ActiveRecordModelExtention' do 
     | 
|
| 
       397 
397 
     | 
    
         
             
                  end
         
     | 
| 
       398 
398 
     | 
    
         | 
| 
       399 
399 
     | 
    
         
             
                  it 'stays when converted to an array' do
         
     | 
| 
       400 
     | 
    
         
            -
                    npw = NobelPrizeWinner.with_filters({nobel_prize_winners 
     | 
| 
      
 400 
     | 
    
         
            +
                    npw = NobelPrizeWinner.with_filters({'nobel_prize_winners' => {'first_name' => 'Albert'}}).to_a
         
     | 
| 
       401 
401 
     | 
    
         
             
                    npw.with_filters_data[:param_namespace].should == :nobel_prize_winners
         
     | 
| 
       402 
402 
     | 
    
         
             
                    npw.with_filters_data[:column_types].should == {
         
     | 
| 
       403 
403 
     | 
    
         
             
                      id:         :integer,
         
     | 
| 
         @@ -412,18 +412,18 @@ describe 'WithFilters::ActiveRecordModelExtention' do 
     | 
|
| 
       412 
412 
     | 
    
         | 
| 
       413 
413 
     | 
    
         
             
                context 'limit the need for specifying table names to resolve ambiguity' do
         
     | 
| 
       414 
414 
     | 
    
         
             
                  it 'prepends the table name to the field if the field is in the primary table' do
         
     | 
| 
       415 
     | 
    
         
            -
                    npw = NobelPrizeWinner.joins(:nobel_prizes).with_filters({nobel_prize_winners 
     | 
| 
      
 415 
     | 
    
         
            +
                    npw = NobelPrizeWinner.joins(:nobel_prizes).with_filters({'nobel_prize_winners' => {'birthdate' => '19140325'}})
         
     | 
| 
       416 
416 
     | 
    
         
             
                    npw.where_values.first.should =~ /^#{npw.table_name}\./
         
     | 
| 
       417 
417 
     | 
    
         
             
                  end 
         
     | 
| 
       418 
418 
     | 
    
         | 
| 
       419 
419 
     | 
    
         
             
                  it 'does not affect non-primary fields' do
         
     | 
| 
       420 
     | 
    
         
            -
                    npw = NobelPrizeWinner.joins(:nobel_prizes).with_filters({nobel_prize_winners 
     | 
| 
      
 420 
     | 
    
         
            +
                    npw = NobelPrizeWinner.joins(:nobel_prizes).with_filters({'nobel_prize_winners' => {'year' => '1903'}})
         
     | 
| 
       421 
421 
     | 
    
         
             
                    npw.where_values.first.should =~ /^#{npw.connection.quote_column_name('year')}/
         
     | 
| 
       422 
422 
     | 
    
         
             
                  end 
         
     | 
| 
       423 
423 
     | 
    
         
             
                end
         
     | 
| 
       424 
424 
     | 
    
         | 
| 
       425 
425 
     | 
    
         
             
                it 'quotes column names' do
         
     | 
| 
       426 
     | 
    
         
            -
                  npw = NobelPrizeWinner.joins(:nobel_prizes).with_filters({nobel_prize_winners 
     | 
| 
      
 426 
     | 
    
         
            +
                  npw = NobelPrizeWinner.joins(:nobel_prizes).with_filters({'nobel_prize_winners' => {'year' => '1903'}})
         
     | 
| 
       427 
427 
     | 
    
         
             
                  npw.where_values.first.should =~ /^#{npw.connection.quote_column_name('year')}/
         
     | 
| 
       428 
428 
     | 
    
         
             
                end
         
     | 
| 
       429 
429 
     | 
    
         | 
| 
         @@ -121,7 +121,7 @@ describe WithFilters::ActionViewExtension do 
     | 
|
| 
       121 
121 
     | 
    
         
             
                  context 'with ranged inputs' do
         
     | 
| 
       122 
122 
     | 
    
         
             
                    context 'types' do
         
     | 
| 
       123 
123 
     | 
    
         
             
                      context 'text' do
         
     | 
| 
       124 
     | 
    
         
            -
                        let(:filter) {WithFilters::Filter::TextRange.new(:year, :foo, {start 
     | 
| 
      
 124 
     | 
    
         
            +
                        let(:filter) {WithFilters::Filter::TextRange.new(:year, :foo, {'start' =>  1900, 'stop' => 2000})}
         
     | 
| 
       125 
125 
     | 
    
         
             
                        subject {helper.with_filters_input(filter)}
         
     | 
| 
       126 
126 
     | 
    
         | 
| 
       127 
127 
     | 
    
         
             
                        context 'start' do
         
     | 
| 
         @@ -148,7 +148,7 @@ describe WithFilters::ActionViewExtension do 
     | 
|
| 
       148 
148 
     | 
    
         
             
                      end
         
     | 
| 
       149 
149 
     | 
    
         | 
| 
       150 
150 
     | 
    
         
             
                      context 'select' do
         
     | 
| 
       151 
     | 
    
         
            -
                        let(:filter) {WithFilters::Filter::SelectRange.new(:year, :foo, {start 
     | 
| 
      
 151 
     | 
    
         
            +
                        let(:filter) {WithFilters::Filter::SelectRange.new(:year, :foo, {'start' =>  1900, 'stop' =>  1905}, collection: 1900..1910)}
         
     | 
| 
       152 
152 
     | 
    
         
             
                        subject {helper.with_filters_input(filter)}
         
     | 
| 
       153 
153 
     | 
    
         | 
| 
       154 
154 
     | 
    
         
             
                        context 'start' do
         
     | 
| 
         @@ -206,7 +206,7 @@ describe WithFilters::ActionViewExtension do 
     | 
|
| 
       206 
206 
     | 
    
         | 
| 
       207 
207 
     | 
    
         
             
                context 'param value is available' do
         
     | 
| 
       208 
208 
     | 
    
         
             
                  it 'creates an input with a value' do
         
     | 
| 
       209 
     | 
    
         
            -
                    helper.stub(:params).and_return({nobel_prize_winners 
     | 
| 
      
 209 
     | 
    
         
            +
                    helper.stub(:params).and_return({'nobel_prize_winners' => {'first_name' => 'Albert'}})
         
     | 
| 
       210 
210 
     | 
    
         
             
                    output = helper.filter_form_for(NobelPrizeWinner.with_filters) do |f|
         
     | 
| 
       211 
211 
     | 
    
         
             
                      f.input :first_name
         
     | 
| 
       212 
212 
     | 
    
         
             
                    end
         
     | 
| 
         @@ -18,7 +18,7 @@ describe WithFilters::ValuePrep::DatePrep do 
     | 
|
| 
       18 
18 
     | 
    
         | 
| 
       19 
19 
     | 
    
         
             
                context 'value is a Hash' do
         
     | 
| 
       20 
20 
     | 
    
         
             
                  it 'returns a Hash of Date objects' do
         
     | 
| 
       21 
     | 
    
         
            -
                    value = described_class.new({start 
     | 
| 
      
 21 
     | 
    
         
            +
                    value = described_class.new({'start' => '19140325', 'stop' => '19140326'}).value
         
     | 
| 
       22 
22 
     | 
    
         | 
| 
       23 
23 
     | 
    
         
             
                    value[:start].should be_an_instance_of(Date)
         
     | 
| 
       24 
24 
     | 
    
         
             
                    value[:stop].should be_an_instance_of(Date)
         
     | 
| 
         @@ -54,51 +54,51 @@ describe WithFilters::ValuePrep::DateTimePrep do 
     | 
|
| 
       54 
54 
     | 
    
         
             
                context 'is a Hash representing a datetime range' do
         
     | 
| 
       55 
55 
     | 
    
         
             
                  context 'to a fraction of a second' do
         
     | 
| 
       56 
56 
     | 
    
         
             
                    it 'returns a Hash of values' do
         
     | 
| 
       57 
     | 
    
         
            -
                      datetimes = {start 
     | 
| 
      
 57 
     | 
    
         
            +
                      datetimes = {'start' => '1914-03-25 12:34:56.123456', 'stop' => '1914-03-26 12:34:56.654321'}
         
     | 
| 
       58 
58 
     | 
    
         
             
                      value = described_class.new(datetimes).value
         
     | 
| 
       59 
59 
     | 
    
         | 
| 
       60 
     | 
    
         
            -
                      value[:start].should == Time.zone.parse(datetimes[ 
     | 
| 
       61 
     | 
    
         
            -
                      value[:stop].should  == Time.zone.parse(datetimes[ 
     | 
| 
      
 60 
     | 
    
         
            +
                      value[:start].should == Time.zone.parse(datetimes['start']).to_s(:db) + '.123456'
         
     | 
| 
      
 61 
     | 
    
         
            +
                      value[:stop].should  == Time.zone.parse(datetimes['stop']).to_s(:db) + '.654321'
         
     | 
| 
       62 
62 
     | 
    
         
             
                    end
         
     | 
| 
       63 
63 
     | 
    
         
             
                  end
         
     | 
| 
       64 
64 
     | 
    
         | 
| 
       65 
65 
     | 
    
         
             
                  context 'to a second' do
         
     | 
| 
       66 
66 
     | 
    
         
             
                    it 'returns a Hash of values' do
         
     | 
| 
       67 
     | 
    
         
            -
                      datetimes = {start 
     | 
| 
      
 67 
     | 
    
         
            +
                      datetimes = {'start' => '1914-03-25 12:34:56', 'stop' => '1914-03-26 12:34:56'}
         
     | 
| 
       68 
68 
     | 
    
         
             
                      value = described_class.new(datetimes).value
         
     | 
| 
       69 
69 
     | 
    
         | 
| 
       70 
     | 
    
         
            -
                      value[:start].should == Time.zone.parse(datetimes[ 
     | 
| 
       71 
     | 
    
         
            -
                      value[:stop].should  == Time.zone.parse(datetimes[ 
     | 
| 
      
 70 
     | 
    
         
            +
                      value[:start].should == Time.zone.parse(datetimes['start']).to_s(:db)
         
     | 
| 
      
 71 
     | 
    
         
            +
                      value[:stop].should  == Time.zone.parse(datetimes['stop']).advance(seconds: 1).to_s(:db)
         
     | 
| 
       72 
72 
     | 
    
         
             
                    end
         
     | 
| 
       73 
73 
     | 
    
         
             
                  end
         
     | 
| 
       74 
74 
     | 
    
         | 
| 
       75 
75 
     | 
    
         
             
                  context 'to a minute' do
         
     | 
| 
       76 
76 
     | 
    
         
             
                    it 'returns a Hash of values' do
         
     | 
| 
       77 
     | 
    
         
            -
                      datetimes = {start 
     | 
| 
      
 77 
     | 
    
         
            +
                      datetimes = {'start' => '1914-03-25 12:34', 'stop' => '1914-03-26 12:34'}
         
     | 
| 
       78 
78 
     | 
    
         
             
                      value = described_class.new(datetimes).value
         
     | 
| 
       79 
79 
     | 
    
         | 
| 
       80 
     | 
    
         
            -
                      value[:start].should == Time.zone.parse(datetimes[ 
     | 
| 
       81 
     | 
    
         
            -
                      value[:stop].should  == Time.zone.parse(datetimes[ 
     | 
| 
      
 80 
     | 
    
         
            +
                      value[:start].should == Time.zone.parse(datetimes['start']).to_s(:db)
         
     | 
| 
      
 81 
     | 
    
         
            +
                      value[:stop].should  == Time.zone.parse(datetimes['stop']).advance(minutes: 1).to_s(:db)
         
     | 
| 
       82 
82 
     | 
    
         
             
                    end
         
     | 
| 
       83 
83 
     | 
    
         
             
                  end
         
     | 
| 
       84 
84 
     | 
    
         | 
| 
       85 
85 
     | 
    
         
             
                  context 'to an hour' do
         
     | 
| 
       86 
86 
     | 
    
         
             
                    it 'returns a Hash of values' do
         
     | 
| 
       87 
     | 
    
         
            -
                      datetimes = {start 
     | 
| 
      
 87 
     | 
    
         
            +
                      datetimes = {'start' => '1914-03-25 12', 'stop' => '1914-03-26 12'}
         
     | 
| 
       88 
88 
     | 
    
         
             
                      value = described_class.new(datetimes).value
         
     | 
| 
       89 
89 
     | 
    
         | 
| 
       90 
     | 
    
         
            -
                      value[:start].should == Time.zone.parse(datetimes[ 
     | 
| 
       91 
     | 
    
         
            -
                      value[:stop].should  == Time.zone.parse(datetimes[ 
     | 
| 
      
 90 
     | 
    
         
            +
                      value[:start].should == Time.zone.parse(datetimes['start']).to_s(:db)
         
     | 
| 
      
 91 
     | 
    
         
            +
                      value[:stop].should  == Time.zone.parse(datetimes['stop']).advance(hours: 1).to_s(:db)
         
     | 
| 
       92 
92 
     | 
    
         
             
                    end
         
     | 
| 
       93 
93 
     | 
    
         
             
                  end
         
     | 
| 
       94 
94 
     | 
    
         | 
| 
       95 
95 
     | 
    
         
             
                  context 'to a day' do
         
     | 
| 
       96 
96 
     | 
    
         
             
                    it 'returns a Hash of values' do
         
     | 
| 
       97 
     | 
    
         
            -
                      dates = {start 
     | 
| 
      
 97 
     | 
    
         
            +
                      dates = {'start' => '19140325', 'stop' => '19140326'}
         
     | 
| 
       98 
98 
     | 
    
         
             
                      date_time_prep = described_class.new(dates)
         
     | 
| 
       99 
99 
     | 
    
         | 
| 
       100 
     | 
    
         
            -
                      date_time_prep.value[:start].should == Time.zone.parse(dates[ 
     | 
| 
       101 
     | 
    
         
            -
                      date_time_prep.value[:stop].should  == Time.zone.parse(dates[ 
     | 
| 
      
 100 
     | 
    
         
            +
                      date_time_prep.value[:start].should == Time.zone.parse(dates['start']).to_s(:db)
         
     | 
| 
      
 101 
     | 
    
         
            +
                      date_time_prep.value[:stop].should  == Time.zone.parse(dates['stop']).advance(days: 1).to_s(:db)
         
     | 
| 
       102 
102 
     | 
    
         
             
                    end
         
     | 
| 
       103 
103 
     | 
    
         
             
                  end
         
     | 
| 
       104 
104 
     | 
    
         
             
                end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: with_filters
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0.1. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.1.2
         
     | 
| 
       5 
5 
     | 
    
         
             
              prerelease: 
         
     | 
| 
       6 
6 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       7 
7 
     | 
    
         
             
            authors:
         
     | 
| 
         @@ -13,7 +13,7 @@ date: 2012-04-16 00:00:00.000000000 Z 
     | 
|
| 
       13 
13 
     | 
    
         
             
            dependencies:
         
     | 
| 
       14 
14 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       15 
15 
     | 
    
         
             
              name: rails
         
     | 
| 
       16 
     | 
    
         
            -
              requirement: & 
     | 
| 
      
 16 
     | 
    
         
            +
              requirement: &70238025295980 !ruby/object:Gem::Requirement
         
     | 
| 
       17 
17 
     | 
    
         
             
                none: false
         
     | 
| 
       18 
18 
     | 
    
         
             
                requirements:
         
     | 
| 
       19 
19 
     | 
    
         
             
                - - ! '>='
         
     | 
| 
         @@ -21,10 +21,10 @@ dependencies: 
     | 
|
| 
       21 
21 
     | 
    
         
             
                    version: '3.1'
         
     | 
| 
       22 
22 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       23 
23 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       24 
     | 
    
         
            -
              version_requirements: * 
     | 
| 
      
 24 
     | 
    
         
            +
              version_requirements: *70238025295980
         
     | 
| 
       25 
25 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       26 
26 
     | 
    
         
             
              name: rspec-rails
         
     | 
| 
       27 
     | 
    
         
            -
              requirement: & 
     | 
| 
      
 27 
     | 
    
         
            +
              requirement: &70238025294460 !ruby/object:Gem::Requirement
         
     | 
| 
       28 
28 
     | 
    
         
             
                none: false
         
     | 
| 
       29 
29 
     | 
    
         
             
                requirements:
         
     | 
| 
       30 
30 
     | 
    
         
             
                - - ! '>='
         
     | 
| 
         @@ -32,10 +32,10 @@ dependencies: 
     | 
|
| 
       32 
32 
     | 
    
         
             
                    version: '0'
         
     | 
| 
       33 
33 
     | 
    
         
             
              type: :development
         
     | 
| 
       34 
34 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       35 
     | 
    
         
            -
              version_requirements: * 
     | 
| 
      
 35 
     | 
    
         
            +
              version_requirements: *70238025294460
         
     | 
| 
       36 
36 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       37 
37 
     | 
    
         
             
              name: sqlite3
         
     | 
| 
       38 
     | 
    
         
            -
              requirement: & 
     | 
| 
      
 38 
     | 
    
         
            +
              requirement: &70238025291900 !ruby/object:Gem::Requirement
         
     | 
| 
       39 
39 
     | 
    
         
             
                none: false
         
     | 
| 
       40 
40 
     | 
    
         
             
                requirements:
         
     | 
| 
       41 
41 
     | 
    
         
             
                - - ! '>='
         
     | 
| 
         @@ -43,10 +43,10 @@ dependencies: 
     | 
|
| 
       43 
43 
     | 
    
         
             
                    version: '0'
         
     | 
| 
       44 
44 
     | 
    
         
             
              type: :development
         
     | 
| 
       45 
45 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       46 
     | 
    
         
            -
              version_requirements: * 
     | 
| 
      
 46 
     | 
    
         
            +
              version_requirements: *70238025291900
         
     | 
| 
       47 
47 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       48 
48 
     | 
    
         
             
              name: genspec
         
     | 
| 
       49 
     | 
    
         
            -
              requirement: & 
     | 
| 
      
 49 
     | 
    
         
            +
              requirement: &70238025303440 !ruby/object:Gem::Requirement
         
     | 
| 
       50 
50 
     | 
    
         
             
                none: false
         
     | 
| 
       51 
51 
     | 
    
         
             
                requirements:
         
     | 
| 
       52 
52 
     | 
    
         
             
                - - ! '>='
         
     | 
| 
         @@ -54,10 +54,10 @@ dependencies: 
     | 
|
| 
       54 
54 
     | 
    
         
             
                    version: '0'
         
     | 
| 
       55 
55 
     | 
    
         
             
              type: :development
         
     | 
| 
       56 
56 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       57 
     | 
    
         
            -
              version_requirements: * 
     | 
| 
      
 57 
     | 
    
         
            +
              version_requirements: *70238025303440
         
     | 
| 
       58 
58 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       59 
59 
     | 
    
         
             
              name: capybara
         
     | 
| 
       60 
     | 
    
         
            -
              requirement: & 
     | 
| 
      
 60 
     | 
    
         
            +
              requirement: &70238025299980 !ruby/object:Gem::Requirement
         
     | 
| 
       61 
61 
     | 
    
         
             
                none: false
         
     | 
| 
       62 
62 
     | 
    
         
             
                requirements:
         
     | 
| 
       63 
63 
     | 
    
         
             
                - - ! '>='
         
     | 
| 
         @@ -65,7 +65,7 @@ dependencies: 
     | 
|
| 
       65 
65 
     | 
    
         
             
                    version: '0'
         
     | 
| 
       66 
66 
     | 
    
         
             
              type: :development
         
     | 
| 
       67 
67 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       68 
     | 
    
         
            -
              version_requirements: * 
     | 
| 
      
 68 
     | 
    
         
            +
              version_requirements: *70238025299980
         
     | 
| 
       69 
69 
     | 
    
         
             
            description: Add filtering to lists, tables, etc.
         
     | 
| 
       70 
70 
     | 
    
         
             
            email:
         
     | 
| 
       71 
71 
     | 
    
         
             
            - aaron.lasseigne@gmail.com
         
     | 
| 
         @@ -195,7 +195,7 @@ required_ruby_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       195 
195 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       196 
196 
     | 
    
         
             
                  segments:
         
     | 
| 
       197 
197 
     | 
    
         
             
                  - 0
         
     | 
| 
       198 
     | 
    
         
            -
                  hash:  
     | 
| 
      
 198 
     | 
    
         
            +
                  hash: 4254393043876456113
         
     | 
| 
       199 
199 
     | 
    
         
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         
     | 
| 
       200 
200 
     | 
    
         
             
              none: false
         
     | 
| 
       201 
201 
     | 
    
         
             
              requirements:
         
     | 
| 
         @@ -204,7 +204,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       204 
204 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       205 
205 
     | 
    
         
             
                  segments:
         
     | 
| 
       206 
206 
     | 
    
         
             
                  - 0
         
     | 
| 
       207 
     | 
    
         
            -
                  hash:  
     | 
| 
      
 207 
     | 
    
         
            +
                  hash: 4254393043876456113
         
     | 
| 
       208 
208 
     | 
    
         
             
            requirements: []
         
     | 
| 
       209 
209 
     | 
    
         
             
            rubyforge_project: with_filters
         
     | 
| 
       210 
210 
     | 
    
         
             
            rubygems_version: 1.8.11
         
     |