Conversation
|
That's awesome, but let's use the kaminari gem instead of will paginate because it's actively maintained. Also please add a some tests (in |
|
Hi, Cezar, I changed the pagination gem to Kaminari, and wrote a Controller test in RSpec, but it's still not passing. Jake |
Gemfile
Outdated
There was a problem hiding this comment.
this one should probably go in the test group
There was a problem hiding this comment.
Agreed, I added kaminari-rspec to the test group.
I added a paginate_posts_index_spec.rb feature test to the spec/features folder, which seems to be passing, but Kaminari's paginate method seems to be throwing errors across other tests.
I made changes to the Views, and ALL of the Features tests are passing (!!!)
There was a problem hiding this comment.
Do we really need to call .all here?
There was a problem hiding this comment.
We should probably have more than 5 posts on a page (.per(5)). Also you should put the number in a constant.
There was a problem hiding this comment.
Fixed. No need to call .all, and I set the number of posts per page to 10, in the config/initializers/kaminari_config.rb file
I made suggested changes, but still need to revise the paginate posts spec file. The tests are all passing, however.
There was a problem hiding this comment.
@blog_posts is already set in the controller. You don't need to set it again in the view.
config/routes.rb
Outdated
There was a problem hiding this comment.
Let's try to use the new hash syntax key: :value instead of :key => :value
|
Hi, Cezar, |
Hi @chalmagean,
I added pagination via the will_paginate rubygem. Not sure if this is the route you wanted to go, but I guess it does the job.
Jake