|
|
|
@ -161,6 +161,10 @@ RSpec.describe CaseLogsController, type: :request do
|
|
|
|
|
|
|
|
|
|
before do |
|
|
|
|
sign_in user |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
context "when there are less than 20 logs" do |
|
|
|
|
before do |
|
|
|
|
get "/logs", headers: headers, params: {} |
|
|
|
|
end |
|
|
|
|
|
|
|
|
@ -189,13 +193,26 @@ RSpec.describe CaseLogsController, type: :request do
|
|
|
|
|
expect(CGI.unescape_html(response.body)).to match("<strong>1</strong> total logs") |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "does not show the pagination links" do |
|
|
|
|
expect(page).not_to have_link("Previous") |
|
|
|
|
expect(page).not_to have_link("Next") |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "does not show the pagination result line" do |
|
|
|
|
expect(CGI.unescape_html(response.body)).not_to match("Showing <b>1</b> to <b>20</b> of <b>26</b> logs") |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
context "when there are more than 20 logs" do |
|
|
|
|
before do |
|
|
|
|
FactoryBot.create_list(:case_log, 25, owning_organisation: organisation, managing_organisation: organisation) |
|
|
|
|
get "/logs", headers: headers, params: {} |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
context "when on the first page" do |
|
|
|
|
before do |
|
|
|
|
get "/logs", headers: headers, params: {} |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "has pagination links" do |
|
|
|
|
expect(page).to have_content("Previous") |
|
|
|
|
expect(page).not_to have_link("Previous") |
|
|
|
|