lhs 7.0.2 → 7.0.3
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 +4 -4
- data/lib/lhs/concerns/record/request.rb +0 -1
- data/lib/lhs/version.rb +1 -1
- data/spec/record/includes_spec.rb +20 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3b68013c1cbb727863cd5e9663514a40475d0227
|
4
|
+
data.tar.gz: daf3023f0202a22500cdd1c6a76a50130e8efd84
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b36060eba538b2f162068cd0a22d60e2de23546277c2393713c20d910a6d308546c2ebc7ec4af5287e97d6b9d8823841cdfff05c45c8a7be5d74bdd4776f32f7
|
7
|
+
data.tar.gz: a838dbb8de2e897f4f2914920538c31fe1d83a2f536b557fd89a8db660852c3367f462b99e4e90844728ade7aff3d3765f7affb215b6fc2bdd9c924b5f922099
|
@@ -39,7 +39,6 @@ class LHS::Record
|
|
39
39
|
|
40
40
|
# Extends existing raw data with additionaly fetched data
|
41
41
|
def extend_raw_data!(data, addition, key)
|
42
|
-
return if addition.empty?
|
43
42
|
if data.collection?
|
44
43
|
extend_base_collection!(data, addition, key)
|
45
44
|
elsif data[key]._raw.is_a? Array
|
data/lib/lhs/version.rb
CHANGED
@@ -448,5 +448,25 @@ describe LHS::Record do
|
|
448
448
|
place.contracts.first.product.name
|
449
449
|
).to eq 'Local Logo'
|
450
450
|
end
|
451
|
+
|
452
|
+
it 'expands empty arrays' do
|
453
|
+
stub_request(:get, "http://datastore/places/123")
|
454
|
+
.to_return(body: {
|
455
|
+
'contracts' => {
|
456
|
+
'href' => "http://datastore/places/123/contracts"
|
457
|
+
}
|
458
|
+
}.to_json)
|
459
|
+
stub_request(:get, "http://datastore/places/123/contracts")
|
460
|
+
.to_return(body: {
|
461
|
+
href: "http://datastore/places/123/contracts",
|
462
|
+
items: []
|
463
|
+
}.to_json)
|
464
|
+
place = Place.includes(:contracts).find('123')
|
465
|
+
expect(place.contracts.collection?).to eq true
|
466
|
+
expect(
|
467
|
+
place.contracts.as_json
|
468
|
+
).to eq('href' => 'http://datastore/places/123/contracts', 'items' => [])
|
469
|
+
expect(place.contracts.to_a).to eq([])
|
470
|
+
end
|
451
471
|
end
|
452
472
|
end
|