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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a6ef5524ff9e948847824a817645866f6c19e19c
4
- data.tar.gz: 8fa5c95d922cac9de6adc95509410b475d293693
3
+ metadata.gz: 3b68013c1cbb727863cd5e9663514a40475d0227
4
+ data.tar.gz: daf3023f0202a22500cdd1c6a76a50130e8efd84
5
5
  SHA512:
6
- metadata.gz: 65195f7a18c36afbdebe4c8441559de59dc7252c3471ec27bf060f7b0dd880327b81cd319c46e19e8aaa6466ff5810441f788a6a148fa35e6eeabc15a6464a9d
7
- data.tar.gz: 36fadb3d46b9531e8d8b1b46e49b12c66544f47ae5c49a203650ae80a01e53ee48bb6497845cc23dae5c159e5c77ba0f445be93bcd5c6e3c3bf3eedf6b2218fe
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
@@ -1,3 +1,3 @@
1
1
  module LHS
2
- VERSION = "7.0.2"
2
+ VERSION = "7.0.3"
3
3
  end
@@ -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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lhs
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.0.2
4
+ version: 7.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - https://github.com/local-ch/lhs/graphs/contributors