From 7db9dae2873d2b90f13e0b7a0d52d08331fc5e8c Mon Sep 17 00:00:00 2001 From: JG Date: Tue, 24 May 2022 12:12:07 +0100 Subject: [PATCH] failing test getting searched logs --- spec/requests/case_logs_controller_spec.rb | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/spec/requests/case_logs_controller_spec.rb b/spec/requests/case_logs_controller_spec.rb index 51fe25fe3..f44b3652a 100644 --- a/spec/requests/case_logs_controller_spec.rb +++ b/spec/requests/case_logs_controller_spec.rb @@ -8,7 +8,7 @@ RSpec.describe CaseLogsController, type: :request do let(:api_password) { "test_password" } let(:basic_credentials) do ActionController::HttpAuthentication::Basic - .encode_credentials(api_username, api_password) + .encode_credentials(api_username, api_password) end let(:headers) do @@ -184,6 +184,16 @@ RSpec.describe CaseLogsController, type: :request do expect(page).to have_content("UA984") end + context "with a search bar" do + let!(:logs) { FactoryBot.create_list(:case_log, 5) } + + it "shows case logs mathing the search word" do + get "/logs?search-field=#{logs.first.id}", headers: headers, params: {} + expect(page).to have_content(logs.first.id) + expect(page).not_to have_content(logs.last.id) + end + end + context "when filtering" do context "with status filter" do let(:organisation_2) { FactoryBot.create(:organisation) }