Browse Source

Add total count

pull/438/head
baarkerlounger 3 years ago
parent
commit
d5ebb72884
  1. 2
      app/views/pagy/_nav.html.erb
  2. 8
      spec/requests/case_logs_controller_spec.rb

2
app/views/pagy/_nav.html.erb

@ -33,6 +33,6 @@
</li> </li>
</ul> </ul>
<p class="app_pagination__results"> <p class="app_pagination__results">
Showing <b><%= pagy.from %></b> to <b><%= pagy.to %></b> logs Showing <b><%= pagy.from %></b> to <b><%= pagy.to %></b> of <b><%= pagy.count %></b> logs
</p> </p>
</nav> </nav>

8
spec/requests/case_logs_controller_spec.rb

@ -191,9 +191,7 @@ RSpec.describe CaseLogsController, type: :request do
context "when there are more than 20 logs" do context "when there are more than 20 logs" do
before do before do
25.times do FactoryBot.create_list(:case_log, 25, owning_organisation: organisation, managing_organisation: organisation)
FactoryBot.create(:case_log, owning_organisation: organisation, managing_organisation: organisation,)
end
get "/logs", headers: headers, params: {} get "/logs", headers: headers, params: {}
end end
@ -206,7 +204,7 @@ RSpec.describe CaseLogsController, type: :request do
end end
it "shows which logs are being shown on the current page" do it "shows which logs are being shown on the current page" do
expect(CGI.unescape_html(response.body)).to match("Showing <b>1</b> to <b>20</b> logs") expect(CGI.unescape_html(response.body)).to match("Showing <b>1</b> to <b>20</b> of <b>26</b> logs")
end end
end end
@ -227,7 +225,7 @@ RSpec.describe CaseLogsController, type: :request do
end end
it "shows which logs are being shown on the current page" do it "shows which logs are being shown on the current page" do
expect(CGI.unescape_html(response.body)).to match("Showing <b>21</b> to <b>26</b> logs") expect(CGI.unescape_html(response.body)).to match("Showing <b>21</b> to <b>26</b> of <b>26</b> logs")
end end
end end
end end

Loading…
Cancel
Save