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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3e53d6922c4422fed246ccc6d625ac21668788f962873e6b04e83689684e9a39
|
|
4
|
+
data.tar.gz: 63d031e91c573ec7413d82bfa0c718b3b61736d6aa6583efd5a7dc848e7baf1b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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 =
|
|
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
|
-
|
|
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
|
|
data/lib/forest_liana/version.rb
CHANGED
|
@@ -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
|