forest_liana 1.6.13 → 1.6.14

Sign up to get free protection for your applications and to get access to all the features.
@@ -32,3 +32,10 @@ tree_5:
32
32
  owner_id: 3
33
33
  created_at: <%= Time.now.year - 3 %>-06-18 09:00:00
34
34
  updated_at: <%= Time.now.year - 3 %>-06-18 09:00:00
35
+
36
+ tree_6:
37
+ id: 6
38
+ name: Oak
39
+ owner_id: 3
40
+ created_at: <%= Time.now + 5.hours + 1.minute %>
41
+ updated_at: <%= Time.now + 5.hours + 1.minute %>
@@ -104,6 +104,27 @@ module ForestLiana
104
104
  assert records.first.owner.name == 'Arnaud Besnier'
105
105
  end
106
106
 
107
+ test 'Filter before x days' do
108
+ getter = ResourcesGetter.new(Tree, {
109
+ fields: { 'trees' => 'id' },
110
+ page: { size: 10, number: 1 },
111
+ filter: {
112
+ 'created_at' => '$3HoursBefore',
113
+ },
114
+ filterType: 'and',
115
+ timezone: '-08:00'
116
+ })
117
+ getter.perform
118
+ records = getter.records
119
+ count = getter.count
120
+
121
+ assert records.count == 5
122
+ assert count = 5
123
+ assert records.first.id == 4
124
+ assert records.first.name == 'Oak'
125
+ assert records.first.owner.name == 'Arnaud Besnier'
126
+ end
127
+
107
128
  test 'Sort on an ambiguous field name with a filter' do
108
129
  getter = ResourcesGetter.new(Tree, {
109
130
  fields: { 'trees' => 'id' },
@@ -150,9 +171,9 @@ module ForestLiana
150
171
  records = getter.records
151
172
  count = getter.count
152
173
 
153
- assert records.count == 1
154
- assert count = 1
155
- assert records.first.id == 5
174
+ assert records.count == 2
175
+ assert count = 2
176
+ assert records.first.id == 6
156
177
  end
157
178
 
158
179
  test 'Filter equal on an updated_at field of an associated collection' do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: forest_liana
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.13
4
+ version: 1.6.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sandro Munda
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-06-23 00:00:00.000000000 Z
11
+ date: 2017-07-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -313,7 +313,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
313
313
  version: '0'
314
314
  requirements: []
315
315
  rubyforge_project:
316
- rubygems_version: 2.5.1
316
+ rubygems_version: 2.6.12
317
317
  signing_key:
318
318
  specification_version: 4
319
319
  summary: Instant and Customizable Admin Interface.