| 
						
						
							
								
							
						
						
					 | 
					 | 
					@ -259,6 +259,13 @@ RSpec.describe CaseLogsController, type: :request do | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        end | 
					 | 
					 | 
					 | 
					        end | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      end | 
					 | 
					 | 
					 | 
					      end | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        it "only shows case logs for your organisation" do | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					          expected_case_row_log = "<a class=\"govuk-link\" href=\"/logs/#{case_log.id}\">#{case_log.id}</a>" | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					          unauthorized_case_row_log = "<a class=\"govuk-link\" href=\"/logs/#{unauthorized_case_log.id}\">#{unauthorized_case_log.id}</a>" | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					          expect(CGI.unescape_html(response.body)).to include(expected_case_row_log) | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					          expect(CGI.unescape_html(response.body)).not_to include(unauthorized_case_row_log) | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        end | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        it "shows the formatted created at date for each log" do | 
					 | 
					 | 
					 | 
					        it "shows the formatted created at date for each log" do | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					          formatted_date = case_log.created_at.to_formatted_s(:govuk_date) | 
					 | 
					 | 
					 | 
					          formatted_date = case_log.created_at.to_formatted_s(:govuk_date) | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					          expect(CGI.unescape_html(response.body)).to include(formatted_date) | 
					 | 
					 | 
					 | 
					          expect(CGI.unescape_html(response.body)).to include(formatted_date) | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -272,13 +279,26 @@ RSpec.describe CaseLogsController, type: :request do | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					          expect(CGI.unescape_html(response.body)).to match("<strong>1</strong> total logs") | 
					 | 
					 | 
					 | 
					          expect(CGI.unescape_html(response.body)).to match("<strong>1</strong> total logs") | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        end | 
					 | 
					 | 
					 | 
					        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 | 
					 | 
					 | 
					 | 
					      context "when there are more than 20 logs" do | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        before do | 
					 | 
					 | 
					 | 
					        before do | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					          FactoryBot.create_list(:case_log, 25, owning_organisation: organisation, managing_organisation: organisation) | 
					 | 
					 | 
					 | 
					          FactoryBot.create_list(:case_log, 25, owning_organisation: organisation, managing_organisation: organisation) | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					          get "/logs", headers: headers, params: {} | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        end | 
					 | 
					 | 
					 | 
					        end | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        context "when on the first page" do | 
					 | 
					 | 
					 | 
					        context "when on the first page" do | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					          before do | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            get "/logs", headers: headers, params: {} | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					          end | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					          it "has pagination links" do | 
					 | 
					 | 
					 | 
					          it "has pagination links" do | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            expect(page).to have_content("Previous") | 
					 | 
					 | 
					 | 
					            expect(page).to have_content("Previous") | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            expect(page).not_to have_link("Previous") | 
					 | 
					 | 
					 | 
					            expect(page).not_to have_link("Previous") | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					 | 
					
  |