blacklight 5.17.1 → 5.17.2

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: 2bca7c3cd93bf159e1b2272c4992af95d00e0f7a
4
- data.tar.gz: 6bdd13fd311e7a333900dbda9405cace911124d5
3
+ metadata.gz: cb02cacbad8a1eae5549c29ea63d69d742755284
4
+ data.tar.gz: 5ce395c3e3dc278d89fdec2dfbc56845377db6ac
5
5
  SHA512:
6
- metadata.gz: 0dea3c31338322661ddcf300d747a51d01ad96c8969f8ae28508a925e58e7b3917348bf1aaa7921e5c6c7cf820b175bb3d6baa0884711ddd985638b2275ae9e2
7
- data.tar.gz: 912096ba17142a60e2f46730221c236c3292e8d5ed2ada3d2afd6f7965a663b0af1e99d2fde00368e9723c1628fc74222530edcc9a6e68f739ca105b8dbcfa67
6
+ metadata.gz: 09f6375583aa2751d3420688eb39dec519f92fb7cbd99b993ff8616e59246c9716c7d33d00c139bb7e7b890550c04f36a584e33d8ad091bd3fd2bc22236c03d5
7
+ data.tar.gz: 3dbf5104d494af8f835fb76b7e1bdbe1093dd40705d3fcc4ee6545b475c66f71b8dc6378c7c6265b9ca3ca662bdf765689207369327ef8d8c5bb84d953ba7e9d
data/VERSION CHANGED
@@ -1 +1 @@
1
- 5.17.1
1
+ 5.17.2
@@ -36,7 +36,7 @@ module Blacklight
36
36
  # :sort => 'count' or 'index', solr tokens for facet value sorting, default 'count'.
37
37
  def initialize(all_facet_values, arguments)
38
38
  # to_s.to_i will conveniently default to 0 if nil
39
- @offset = arguments[:offset].to_s.to_i
39
+ @offset = arguments[:offset].to_s.to_i
40
40
  @limit = arguments[:limit]
41
41
  @sort = arguments[:sort]
42
42
 
@@ -57,7 +57,8 @@ module Blacklight
57
57
  end
58
58
 
59
59
  def current_page
60
- if limit == 0 #check for divide by zero
60
+ # A nil limit is unlimited, thus only one page.
61
+ if limit.nil? || limit == 0 #check for divide by zero
61
62
  1
62
63
  else
63
64
  @offset / limit + 1
@@ -71,11 +71,22 @@ describe Blacklight::FacetPaginator do
71
71
  end
72
72
 
73
73
  context "for a nil :limit" do
74
- subject { described_class.new(seven_facet_values, offset: 0, limit: nil) }
75
- it "should return all the items" do
76
- expect(subject.items).to eq seven_facet_values
74
+ let(:paginator) { described_class.new(seven_facet_values, offset: 0, limit: nil) }
75
+
76
+ describe "#items" do
77
+ subject { paginator.items }
78
+ it { is_expected.to eq seven_facet_values }
79
+ end
80
+
81
+ describe "#last_page?" do
82
+ subject { paginator.last_page? }
83
+ it { is_expected.to be true }
84
+ end
85
+
86
+ describe "#current_page" do
87
+ subject { paginator.current_page }
88
+ it { is_expected.to eq 1 }
77
89
  end
78
- it { should be_last_page }
79
90
  end
80
91
 
81
92
  describe "#as_json" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blacklight
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.17.1
4
+ version: 5.17.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan Rochkind
@@ -17,7 +17,7 @@ authors:
17
17
  autorequire:
18
18
  bindir: bin
19
19
  cert_chain: []
20
- date: 2015-12-17 00:00:00.000000000 Z
20
+ date: 2016-01-11 00:00:00.000000000 Z
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
23
23
  name: rails