X-Git-Url: https://git.openstreetmap.org/rails.git/blobdiff_plain/f884be441dee0c9412c2f776816cdee225ecb394..aceef47cd8f39928d27df43e2fdfee339ddafdc9:/test/controllers/diary_entries_controller_test.rb diff --git a/test/controllers/diary_entries_controller_test.rb b/test/controllers/diary_entries_controller_test.rb index 8d646c426..c9464ffed 100644 --- a/test/controllers/diary_entries_controller_test.rb +++ b/test/controllers/diary_entries_controller_test.rb @@ -564,11 +564,36 @@ class DiaryEntriesControllerTest < ActionDispatch::IntegrationTest get diary_entries_path assert_response :success assert_select "div.diary_post", :count => 20 + assert_select "li.page-item a.page-link", :text => "Older Entries", :count => 1 + assert_select "li.page-item.disabled span.page-link", :text => "Newer Entries", :count => 1 # Try and get the second page - get diary_entries_path(:page => 2) + get css_select("li.page-item a.page-link").first["href"] assert_response :success assert_select "div.diary_post", :count => 20 + assert_select "li.page-item a.page-link", :text => "Older Entries", :count => 1 + assert_select "li.page-item a.page-link", :text => "Newer Entries", :count => 1 + + # Try and get the third page + get css_select("li.page-item a.page-link").first["href"] + assert_response :success + assert_select "div.diary_post", :count => 10 + assert_select "li.page-item.disabled span.page-link", :text => "Older Entries", :count => 1 + assert_select "li.page-item a.page-link", :text => "Newer Entries", :count => 1 + + # Go back to the second page + get css_select("li.page-item a.page-link").last["href"] + assert_response :success + assert_select "div.diary_post", :count => 20 + assert_select "li.page-item a.page-link", :text => "Older Entries", :count => 1 + assert_select "li.page-item a.page-link", :text => "Newer Entries", :count => 1 + + # Go back to the first page + get css_select("li.page-item a.page-link").last["href"] + assert_response :success + assert_select "div.diary_post", :count => 20 + assert_select "li.page-item a.page-link", :text => "Older Entries", :count => 1 + assert_select "li.page-item.disabled span.page-link", :text => "Newer Entries", :count => 1 end def test_rss