diff --git a/spec/requests/case_logs_controller_spec.rb b/spec/requests/case_logs_controller_spec.rb index b11586f7d..788ec70a3 100644 --- a/spec/requests/case_logs_controller_spec.rb +++ b/spec/requests/case_logs_controller_spec.rb @@ -280,8 +280,38 @@ RSpec.describe CaseLogsController, type: :request do get "/logs", headers: headers, params: {} end - it "shows the total log count" do - expect(CGI.unescape_html(response.body)).to match("26 total logs") + context "when on the first page" do + it "has pagination links" do + expect(page).to have_content("Previous") + expect(page).not_to have_link("Previous") + expect(page).to have_content("Next") + expect(page).to have_link("Next") + end + + it "shows which logs are being shown on the current page" do + expect(CGI.unescape_html(response.body)).to match("Showing 1 to 20 logs") + end + end + + context "when on the second page" do + before do + get "/logs?page=2", headers: headers, params: {} + end + + it "shows the total log count" do + expect(CGI.unescape_html(response.body)).to match("26 total logs") + end + + it "has pagination links" do + expect(page).to have_content("Previous") + expect(page).to have_link("Previous") + expect(page).to have_content("Next") + expect(page).not_to have_link("Next") + end + + it "shows which logs are being shown on the current page" do + expect(CGI.unescape_html(response.body)).to match("Showing 21 to 26 logs") + end end end end