lhs 13.2.2 → 13.2.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 817ac42fa13f753a81ae3cdb118c1603c69e621b
4
- data.tar.gz: 9c25357f8dd19e34c89060cd8937e267b3d72d08
3
+ metadata.gz: 2bda2ff4ae84ce367ee21ad8922b46e600b288c5
4
+ data.tar.gz: c8fc0746ffca39f2b7e5ad370ba71cc884535ec9
5
5
  SHA512:
6
- metadata.gz: d2d61991d9f8c997258796996c74221658f4c6d6e49fd99138794add22d60587ae54b4ef38fe0067fd9779d8b5f7c62a0cc76f907b029c428e18bb5881f21b8c
7
- data.tar.gz: c50e17144b9e7dc502537524659fcdc2f52053697e9c031edb4e560b8fb2f80f3c7683b6b06b3c018a69ad768d82d90031a69cd7725753b08cc2701fe46936bd
6
+ metadata.gz: e298a06e35a61cdbaddbceffc23e7e982e4387b9d21c7753165202e309bc0e463339b511039abf20c3038c389460e4676ef2ce933a285b83cb53b6543ffb180b
7
+ data.tar.gz: d2020691e22febd3f22256c2f689d093e65fd92fb0bb5519ff5413905f54f6a946fe5ce8cbb83ba9b2681322033f7f93ec26f50c4eba56b19e92cb580b267c1c
@@ -11,15 +11,13 @@ module LHS::Pagination
11
11
  self.data = data
12
12
  end
13
13
 
14
- # as standard in Rails' ActiveRecord count is not summing up, but using the number provided from data source
15
- def count
16
- total
17
- end
18
-
19
14
  def total
20
- data._raw.dig(*_record.total_key)
15
+ data._raw.dig(*_record.total_key) || 0
21
16
  end
22
17
 
18
+ # as standard in Rails' ActiveRecord count is not summing up, but using the number provided from data source
19
+ alias count total
20
+
23
21
  def limit
24
22
  data._raw.dig(*_record.limit_key) || DEFAULT_LIMIT
25
23
  end
@@ -1,3 +1,3 @@
1
1
  module LHS
2
- VERSION = "13.2.2"
2
+ VERSION = "13.2.3"
3
3
  end
@@ -15,6 +15,21 @@ describe LHS::Data do
15
15
  end
16
16
  end
17
17
 
18
+ context 'empty collection' do
19
+ let(:collection) do
20
+ LHS::Data.new({ items: [] }, nil, Record)
21
+ end
22
+
23
+ it 'provides correct count and length' do
24
+ expect(collection.count).to eq 0
25
+ expect(collection.length).to eq 0
26
+ end
27
+
28
+ it 'returns an empty array or map' do
29
+ expect(collection.map { |x| }).to eq []
30
+ end
31
+ end
32
+
18
33
  context 'collections' do
19
34
  it 'forwards calls to the collection' do
20
35
  expect(data.count).to be_kind_of Integer
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lhs
3
3
  version: !ruby/object:Gem::Version
4
- version: 13.2.2
4
+ version: 13.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - https://github.com/local-ch/lhs/graphs/contributors
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-08-22 00:00:00.000000000 Z
11
+ date: 2017-08-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: lhc
@@ -417,7 +417,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
417
417
  requirements:
418
418
  - Ruby >= 2.3.0
419
419
  rubyforge_project:
420
- rubygems_version: 2.6.12
420
+ rubygems_version: 2.6.8
421
421
  signing_key:
422
422
  specification_version: 4
423
423
  summary: Rails gem providing an easy, active-record-like interface for http json services