forest_liana 9.20.12 → 9.20.13

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 113a6c37672221a6fb2b94fb001ae0c04101b239e4b1eb6c8046d3c4485da005
4
- data.tar.gz: 928f89e4c0bfa3c5cb925b64ae437caf73aed141f704fafec4464da49d9a5a09
3
+ metadata.gz: 3e53d6922c4422fed246ccc6d625ac21668788f962873e6b04e83689684e9a39
4
+ data.tar.gz: 63d031e91c573ec7413d82bfa0c718b3b61736d6aa6583efd5a7dc848e7baf1b
5
5
  SHA512:
6
- metadata.gz: 07b02e0de1972b2ce1fba69415e2719695eebd0ab69791f34270873667916088a87d214824520b6a26ddf21b6af7dadff2defa69c712f79e1258ac3d6a5e4dcf
7
- data.tar.gz: 6e71fa92203f7ad24a9c5e581b3c57789c479cfd94651040a9078bf075358ddc53256dad73ce4453b14f282fdad5f895bd8bf124167386c4bf50ef0b9f221aac
6
+ metadata.gz: 3a56ce38a01bbebe42696a893bf6e50e762135c8b0579ac488e578468469a3a381963bee3ed1a9c5efb5c73b168aaf80bcfe410ec2f90c25ac80235c29799778
7
+ data.tar.gz: f93ccc8fcd6cfdbb189e623a3cd3095d79bbd8fd94a70cda8d0cf263476ea6fe3226617b8ebffc3b14a804153f975dddd6903a9791b7c75e85da5e15c72a3b91
@@ -6,7 +6,7 @@ module ForestLiana
6
6
  @resource = resource
7
7
  @params = params
8
8
  @user = forest_user
9
- @count_needs_includes = !@params[:search].nil?
9
+ @count_needs_includes = @params[:search].present?
10
10
  @collection_name = ForestLiana.name_for(@resource)
11
11
  @collection = get_collection(@collection_name)
12
12
  @fields_to_serialize = get_fields_to_serialize
@@ -9,7 +9,8 @@ module ForestLiana
9
9
  @includes = includes
10
10
  @collection = collection
11
11
  @fields_searched = []
12
- @search = @params[:search]
12
+ # '' is truthy, so without .presence an empty search still builds LIKE '%%' predicates.
13
+ @search = @params[:search].presence
13
14
  @user = user
14
15
  end
15
16
 
@@ -1,3 +1,3 @@
1
1
  module ForestLiana
2
- VERSION = "9.20.12"
2
+ VERSION = "9.20.13"
3
3
  end
@@ -158,5 +158,36 @@ module ForestLiana
158
158
  expect(records.map(&:name)).to contain_exactly('cedar', 'pine')
159
159
  end
160
160
  end
161
+
162
+ describe 'with extended search and an empty search string' do
163
+ let(:params) do
164
+ {
165
+ id: island.id,
166
+ association_name: 'trees',
167
+ search: '',
168
+ 'searchExtended' => '1',
169
+ page: { size: 15, number: 1 },
170
+ timezone: 'America/Nome'
171
+ }
172
+ end
173
+
174
+ it 'treats an empty search as a no-op instead of building predicates it cannot join' do
175
+ subject.perform
176
+
177
+ expect { subject.records.to_a }.not_to raise_error
178
+ expect(subject.records.to_a.map(&:name)).to contain_exactly('cedar', 'olive', 'pine', 'fig')
179
+ expect(subject.count).to eq(@trees.size)
180
+ end
181
+
182
+ describe 'with a record whose searched columns are all NULL' do
183
+ before(:each) { Tree.create!(name: nil, island: island) }
184
+
185
+ it 'is a no-op, not a filter: the record is still returned' do
186
+ subject.perform
187
+
188
+ expect(subject.records.to_a.map(&:name)).to contain_exactly('cedar', 'olive', 'pine', 'fig', nil)
189
+ end
190
+ end
191
+ end
161
192
  end
162
193
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: forest_liana
3
3
  version: !ruby/object:Gem::Version
4
- version: 9.20.12
4
+ version: 9.20.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sandro Munda