Will_paginate problems
Hi ive been building a new web app based on michael hartl tutorial but im having problems with the will_paginate tests.
When i load all my users it will display every one of them so of course i add gem will_paginate to gemfile and
When i load all my users it will display every one of them so of course i add gem will_paginate to gemfile and
User.paginate(:page => params[:page], :per_page => 30)
to my def index. inside my index.html.erb i have
<%= will_paginate %>
This all works great i load the server and start to browse through my users page by page. Im not sure how its working though becuase in the tests i have this
require 'test_helper' class UsersIndexTest < ActionDispatch::IntegrationTest def setup @user = users(:michael) end test "index including pagination" do log_in_as(@user) get users_path puts @response.body assert 'users/index' assert_select 'div.paginate' #if i remove .paginate assert select test passes. but can not find the paginate code. User.paginate(page: 1, per_page: 10).each do |user| assert_select 'a[href=?]', user_path(user), text: user.username end end end
if on the index.html.erb i add this instead
<div class="paginate"> <%= will_paginate %> </div>
@response.body shows this <div class="paginate"> </div> but there should be another div paginate inside the written one. and if i remove the erb all together leaving the written div things still work. So im lost as to what is happening