folio-pagination 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: a55a0877c52299acf23df1ae57acf27370116d47
4
+ data.tar.gz: 1e870222da86d262dbc2fab03bda04dc0d4d5584
5
+ SHA512:
6
+ metadata.gz: f5fc27771edb78f570d5b4c5040ed6eff0b2d01775d147230e1fc5e1669761d8db620fc072bf23f77104b38ea880a13472000470a90d9959b96fb6a92b0237e2
7
+ data.tar.gz: 43b68e60a84bff8434073f9319ecd2724143ed1ff57b63f11595ff91cd2d4192f59e1cda1ed22a71a18d601f887522c3911214ba9a0edb5217770a6419c2b9e0
data/lib/folio/ordinal.rb CHANGED
@@ -28,6 +28,8 @@ module Folio
28
28
  raise ::Folio::InvalidPage unless page.current_page.is_a?(Integer)
29
29
  raise ::Folio::InvalidPage if page.out_of_bounds?
30
30
  page
31
+ rescue ::WillPaginate::InvalidPage
32
+ raise ::Folio::InvalidPage
31
33
  end
32
34
 
33
35
  # otherwise acts like a normal folio
data/lib/folio/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Folio
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.7"
3
3
  end
@@ -110,6 +110,18 @@ describe ActiveRecord do
110
110
 
111
111
  it "should validate page number against auto-counted total_entries" do
112
112
  lambda{ Item.paginate(page: 4, per_page: 10) }.must_raise Folio::InvalidPage
113
+ end
114
+
115
+ it "should raise on negative page" do
116
+ lambda{ Item.paginate(page: -1) }.must_raise Folio::InvalidPage
117
+ end
118
+
119
+ it "should raise on page of 0" do
120
+ lambda{ Item.paginate(page: 0) }.must_raise Folio::InvalidPage
121
+ end
122
+
123
+ it "should raise on page greater than known last_page" do
124
+ lambda{ Item.paginate(page: 4, total_entries: 30) }.must_raise Folio::InvalidPage
113
125
  end
114
126
 
115
127
  it "should work on relations" do
metadata CHANGED
@@ -1,46 +1,41 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: folio-pagination
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
5
- prerelease:
4
+ version: 0.0.7
6
5
  platform: ruby
7
6
  authors:
8
7
  - Jacob Fugal
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2014-02-24 00:00:00.000000000 Z
11
+ date: 2014-03-06 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: bundler
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ~>
17
+ - - "~>"
20
18
  - !ruby/object:Gem::Version
21
19
  version: '1.3'
22
20
  type: :development
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ~>
24
+ - - "~>"
28
25
  - !ruby/object:Gem::Version
29
26
  version: '1.3'
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: rake
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - ">="
36
32
  - !ruby/object:Gem::Version
37
33
  version: '0'
38
34
  type: :development
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - ">="
44
39
  - !ruby/object:Gem::Version
45
40
  version: '0'
46
41
  description: A pagination library.
@@ -50,8 +45,8 @@ executables: []
50
45
  extensions: []
51
46
  extra_rdoc_files: []
52
47
  files:
53
- - .gitignore
54
- - .travis.yml
48
+ - ".gitignore"
49
+ - ".travis.yml"
55
50
  - Gemfile
56
51
  - Guardfile
57
52
  - LICENSE.txt
@@ -91,27 +86,26 @@ files:
91
86
  homepage: https://github.com/instructure/folio
92
87
  licenses:
93
88
  - MIT
89
+ metadata: {}
94
90
  post_install_message:
95
91
  rdoc_options: []
96
92
  require_paths:
97
93
  - lib
98
94
  required_ruby_version: !ruby/object:Gem::Requirement
99
- none: false
100
95
  requirements:
101
- - - ! '>='
96
+ - - ">="
102
97
  - !ruby/object:Gem::Version
103
98
  version: '0'
104
99
  required_rubygems_version: !ruby/object:Gem::Requirement
105
- none: false
106
100
  requirements:
107
- - - ! '>='
101
+ - - ">="
108
102
  - !ruby/object:Gem::Version
109
103
  version: '0'
110
104
  requirements: []
111
105
  rubyforge_project:
112
- rubygems_version: 1.8.23
106
+ rubygems_version: 2.2.0
113
107
  signing_key:
114
- specification_version: 3
108
+ specification_version: 4
115
109
  summary: Folio is a library for pagination. It's meant to be nearly compatible with
116
110
  WillPaginate, but with broader -- yet more well-defined -- semantics to allow for
117
111
  sources whose page identifiers are non-ordinal.