kaminari-rspec 0.14.1.b0 → 0.14.1.b1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NzNhYjY4ZGY2MGMyMTEyYzc4OGU3MzY3NWY4OTU5OWQ4NjUxYTI1MQ==
4
+ NmJmNDhmY2RjOGZjZGRkODZhYWMyZmE0MjcwOGEyYmJlN2VlZTA5YQ==
5
5
  data.tar.gz: !binary |-
6
- ZTFhYzg2NjdiM2EyYTEwZjU5MWJjMTVkMzUzMGZkMWYyZjQwYjczOA==
6
+ Y2I4YjBmNDg3YTdmMTJiODg0MzYyMzM5MGRiZjBjOTc2OTZlZmQ0Mw==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- MjE4NjM2MDQ5YmEyY2JjMWYwOWIzZDAxYTEzNjljYzQ1ZWI1MmIwYmRjYWMx
10
- OTZiMDA5NWU5MmI5NDdmNjNjNmJlZjM1ZWQ3MWRjOTBjNmRkMWRiNjk5Mjc0
11
- NDhkNGM2MDYwNGE5NmMwZmUzNmE3YTczZmJiOWRhNWFhM2FjMTY=
9
+ Mzk3YjY5YjY0MjA5N2Q1MDRiODA1NDY0Zjk4YjVhNDQ4ZmVjY2JkNWNiODVj
10
+ YjVmNjg0NzJkNzU1NzYwYThkOTE1NmFmZjViYWE5YmNjODdjMTdkZjIyMWFi
11
+ ZGI0MDcyNzMwM2ZmZTk5ZDRjOTg2YWQxY2Y4ZjYxNGQxNjI4OTU=
12
12
  data.tar.gz: !binary |-
13
- NjI1MzZlNGZiYzZkYTgxMjVjYzgyYjgwY2M2ZDYwZTJkZmY1Yjc1OWFlYzM2
14
- MTI3M2I5YzdiNDBiZmRiMzhmNmY1NTkzYjdkMjVhOTEyNTI4YzA3NDQ0NzMx
15
- ZTI2ZjJjMWUzY2ZhNDA1MWZhODU4Mjg1YzJjNWVkZjk5ZDcxY2M=
13
+ ZjFlNDRkZWQ1ZTdiMDAyMTEyNTI0MmQ1M2NiZTI3YzBkN2VjM2U3ODE1NTQw
14
+ ZDNjYWMyYjI2MmY1MjU3OWI5MDJhOTBkY2ZlMWI2Njk3MDc4NTQzYTcxZWVk
15
+ NWE1YTExMmMyODk5MTQyNzEyZmEzMjkyYWZhODBlMDFlNzg3ZTY=
data/.gitignore CHANGED
@@ -1 +1,2 @@
1
1
  Gemfile.lock
2
+ pkg
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ language: ruby
2
+ rvm:
3
+ - "1.9.3"
4
+
5
+ script: bundle exec rake spec
data/README.md CHANGED
@@ -1,70 +1,78 @@
1
- Kaminari Rspec Library
2
- =========================
1
+ # Kaminari Rspec Library
3
2
 
4
3
 
5
4
 
5
+ [![Gem Version](https://badge.fury.io/rb/kaminari-rspec.png)](http://badge.fury.io/rb/kaminari-rspec)
6
+ [![Build Status](https://travis-ci.org/nessche/kaminari-rspec.png)](https://travis-ci.org/nessche/kaminari-rspec)
7
+
8
+
6
9
  `kaminari-rspec` is a ruby gem that aims at simplifying writing the specs for views where Kaminari is used for pagination
7
10
 
8
- Installing
9
- ----------
11
+ ## Installing
12
+
10
13
 
11
14
  Simply install the gem to your system
12
15
 
13
- `gem install kaminari-rspec`
16
+ gem install kaminari-rspec
14
17
 
15
18
  or if you are using Bundler add it to your gemspec file and run `bundle install`.
16
19
 
17
- Gem Versioning
18
- --------------
20
+ ## Gem Versioning
19
21
 
20
22
  The gem version reflects the kaminari version that is supports. Please notice that this gem is maintained in my spare time
21
23
  so delays occur between the release of a new Kaminari version and the release of a new version of this gem. Feel free
22
24
  to fork this repo and update the version and the code as needed.
23
25
 
24
- Rendering views with RSpec's render_view
25
- ----------------------------------------
26
+ ## Rendering views with RSpec's render_view
26
27
 
27
28
  If you are rendering the views from your controller spec using render_views AND you are mocking
28
29
  the data returned from the db with something along the lines of
29
30
 
30
- `Model.stub_chain(:order, :page, :per).and_return([model_mock])`
31
+ Model.stub_chain(:order, :page, :per).and_return([model_mock])
31
32
 
32
33
  you may want to also stub the methods needed by the pagination partials, in order to do that, just
33
34
  add the following to your `spec_helper`
34
35
 
35
- `config.include KaminariRspec::TestHelpers, :type => :controller`
36
+ config.include KaminariRspec::TestHelpers, :type => :controller
36
37
 
37
38
  and then modify your controller spec to look like
38
39
 
39
- `Model.stub_chain(:order, :page, :per).and_return(stub_pagination([model_mock]))`
40
+ Model.stub_chain(:order, :page, :per).and_return(stub_pagination([model_mock]))
40
41
 
41
42
  the stubs will return the values needed to set the pagination as being on the first and only page.
42
43
 
43
- If specific pagination values are needed they can be defined using a hash
44
+ ### Pagination options
45
+
46
+ If specific pagination values are needed they can be defined using a hash. The following values are supported:
47
+
48
+ * `:total_count` : the total number of elements to be paginated. It defaults to `resource.length` if resource is a collection,
49
+ otherwise to 1
50
+ * `:per_page` : the amount of elements per page, defaults to 25
51
+ * `:current_page` : the current page of the pagination. Defaults to 1. Notice that `current_page` is anyway always
52
+ set such that it respects the values passed in `total_count` and `per_page`, i.e. if you pass a
53
+ total count of 95 and a per page value of 10, current page will be capped to 10
54
+
55
+ As an example
44
56
 
45
- `stub_pagination(mocked_result, :total_count => 50, :current_page => 3, :per_page => 10)`
57
+ stub_pagination(resource, :total_count => 50, :current_page => 3, :per_page => 10)
46
58
 
47
- will create the same pagination links as a total count of 50 elements are available, with 10
48
- elements per page and page 3 being the current_page. Notice that `current_page` is anyway always
49
- set such that it respects the values passed in `total_count` and `per_page`, i.e. if you pass a
50
- total count of 95 and a per page value of 10, current page will be capped to 10
59
+ will create the pagination links for a total count of 50 elements, with 10
60
+ elements per page and page 3 being the current_page.
51
61
 
52
- Detecting mocking framework
53
- ---------------------------
62
+ ## Detecting mocking framework
54
63
 
55
64
  If you are using RSpec >= 2.5.2 there is no need to explicitly pass the mocking framework you
56
65
  are using to the stub_pagination method, as it is automatically detected by the TestHelpers.
57
66
  For earlier versions you are required to explicitly use the same string you would pass to
58
67
  `RSpec.configuration.mock_with` , so the actual method call is
59
68
 
60
- `stub_pagination(mocked_result, :mock => :rspec, :total_count => 50, :current_page => 3, :per_page => 10)`
69
+ stub_pagination(mocked_result, :mock => :rspec, :total_count => 50, :current_page => 3, :per_page => 10)
61
70
 
62
- Default values
63
- --------------
71
+ ### Supported mocking frameworks
64
72
 
65
- The TestHelpers will also try to guess values so that you don't need to explicitly pass them all.
66
- * `:per_page` will default to 25
67
- * `:current_page` will default to 1
68
- * `:total_count` will default to 1 if the object passed as resource is not a collection, otherwise it will
69
- invoke get the value from resource.length
73
+ Currently supported mocking frameworks are:
70
74
 
75
+ * RSpec's built-in doubles
76
+ * RR (Double Ruby)
77
+ * Mocha
78
+ * Flexmock
@@ -11,7 +11,7 @@ Gem::Specification.new do |s|
11
11
  s.homepage = 'https://github.com/nessche/kaminari-rspec'
12
12
  s.summary = 'A Rspec Helper library for the Kaminari gem'
13
13
  s.description = 'A Rspec Helper library for the Kaminari gem'
14
-
14
+ s.license = 'MIT'
15
15
 
16
16
  s.files = `git ls-files`.split("\n")
17
17
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
@@ -1,3 +1,3 @@
1
1
  module KaminariRspec
2
- VERSION = '0.14.1.b0'
2
+ VERSION = '0.14.1.b1'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kaminari-rspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.1.b0
4
+ version: 0.14.1.b1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marco Sandrini
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-07-16 00:00:00.000000000 Z
11
+ date: 2013-07-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: kaminari
@@ -116,6 +116,7 @@ extensions: []
116
116
  extra_rdoc_files: []
117
117
  files:
118
118
  - .gitignore
119
+ - .travis.yml
119
120
  - Gemfile
120
121
  - License.txt
121
122
  - README.md
@@ -135,7 +136,8 @@ files:
135
136
  - spec/lib/kaminari_rspec/test_helpers_spec.rb
136
137
  - spec/spec_helper.rb
137
138
  homepage: https://github.com/nessche/kaminari-rspec
138
- licenses: []
139
+ licenses:
140
+ - MIT
139
141
  metadata: {}
140
142
  post_install_message:
141
143
  rdoc_options: []