leaflet 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -40,9 +40,7 @@ module Leaflet
40
40
  # –––––––––––––––––––––––
41
41
 
42
42
  def total_entries
43
- Positify.it {
44
- @total_entries ||= self.size
45
- }
43
+ (@total_entries ||= self.size).to_i.abs
46
44
  end
47
45
  alias :total_count :total_entries # Kaminari
48
46
 
@@ -2,7 +2,7 @@ module Leaflet
2
2
  module VERSION
3
3
  MAJOR = 0
4
4
  MINOR = 0
5
- TINY = 3
5
+ TINY = 4
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
@@ -33,6 +33,10 @@ describe Leaflet::Collection do
33
33
  it 'corresponds to the records size' do
34
34
  collection.total_entries.should == 5
35
35
  end
36
+
37
+ it 'can be zero' do
38
+ Leaflet::Collection.new([]).total_entries.should == 0
39
+ end
36
40
  end
37
41
 
38
42
  describe '#total_count' do
@@ -73,6 +77,10 @@ describe Leaflet::Collection do
73
77
  it 'is calculated from the passed in total' do
74
78
  collection.total_pages.should == 10
75
79
  end
80
+
81
+ it 'cannot be negative' do
82
+ Leaflet::Collection.new([], total: -5).total_entries.should == 5
83
+ end
76
84
  end
77
85
 
78
86
  describe '#per_page' do
@@ -93,5 +101,4 @@ describe Leaflet::Collection do
93
101
  end
94
102
  end
95
103
  end
96
-
97
104
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: leaflet
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-04-24 00:00:00.000000000 Z
12
+ date: 2013-05-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: positify