diff --git a/spec/features/log_spec.rb b/spec/features/log_spec.rb index 98aebb3ef..2e8812b63 100644 --- a/spec/features/log_spec.rb +++ b/spec/features/log_spec.rb @@ -16,9 +16,9 @@ RSpec.describe "Log Features" do end it "displays the logs belonging to the same organisation" do - expect(page).to have_content(log_to_search.id) - expect(page).to have_content(same_organisation_log.id) - expect(page).not_to have_content(another_organisation_log.id) + expect(page).to have_link(log_to_search.id.to_s) + expect(page).to have_link(same_organisation_log.id.to_s) + expect(page).not_to have_link(another_organisation_log.id.to_s) end context "when I search for a specific log" do @@ -35,9 +35,9 @@ RSpec.describe "Log Features" do end it "displays log matching the log ID" do - expect(page).to have_content(log_to_search.id) - expect(page).not_to have_content(same_organisation_log.id) - expect(page).not_to have_content(another_organisation_log.id) + expect(page).to have_link(log_to_search.id.to_s) + expect(page).not_to have_link(same_organisation_log.id.to_s) + expect(page).not_to have_link(another_organisation_log.id.to_s) end context "when I want to clear results" do @@ -45,11 +45,11 @@ RSpec.describe "Log Features" do expect(page).to have_link("Clear search") end - it "displays the logs belonging to the same organisation after I clear the search result after I clear the search resultss" do + it "displays the logs belonging to the same organisation after I clear the search results" do click_link("Clear search") - expect(page).to have_content(log_to_search.id) - expect(page).to have_content(same_organisation_log.id) - expect(page).not_to have_content(another_organisation_log.id) + expect(page).to have_link(log_to_search.id.to_s) + expect(page).to have_link(same_organisation_log.id.to_s) + expect(page).not_to have_link(another_organisation_log.id.to_s) end end end diff --git a/spec/features/organisation_spec.rb b/spec/features/organisation_spec.rb index c5725d541..8d00bf2dd 100644 --- a/spec/features/organisation_spec.rb +++ b/spec/features/organisation_spec.rb @@ -122,9 +122,9 @@ RSpec.describe "User Features" do end it "displays log matching the log ID" do - expect(page).to have_content(log_to_search.id) + expect(page).to have_link(log_to_search.id.to_s) other_logs.each do |log| - expect(page).not_to have_content(log.id) + expect(page).not_to have_link(log.id.to_s) end end @@ -135,7 +135,7 @@ RSpec.describe "User Features" do it "displays the logs belonging to the same organisation after I clear the search result after I clear the search resultss" do click_link("Clear search") - expect(page).to have_content(log_to_search.id) + expect(page).to have_link(log_to_search.id.to_s) end end end diff --git a/spec/requests/case_logs_controller_spec.rb b/spec/requests/case_logs_controller_spec.rb index 29eb5dc04..4e59378df 100644 --- a/spec/requests/case_logs_controller_spec.rb +++ b/spec/requests/case_logs_controller_spec.rb @@ -330,33 +330,33 @@ RSpec.describe CaseLogsController, type: :request do it "shows case logs matching the id" do get "/logs?search=#{log_to_search.id}", headers: headers, params: {} - expect(page).to have_content(log_to_search.id) + expect(page).to have_content(log_to_search.id.to_s) logs.each do |log| - expect(page).not_to have_content(log.id) + expect(page).not_to have_content(log.id.to_s) end end it "shows case logs matching the tenant code" do get "/logs?search=#{log_to_search.tenant_code}", headers: headers, params: {} - expect(page).to have_content(log_to_search.id) + expect(page).to have_link(log_to_search.id.to_s) logs.each do |log| - expect(page).not_to have_content(log.id) + expect(page).not_to have_link(log.id.to_s) end end it "shows case logs matching the property reference" do get "/logs?search=#{log_to_search.propcode}", headers: headers, params: {} - expect(page).to have_content(log_to_search.id) + expect(page).to have_content(log_to_search.id.to_s) logs.each do |log| - expect(page).not_to have_content(log.id) + expect(page).not_to have_link(log.id.to_s) end end it "shows case logs matching the property postcode" do get "/logs?search=#{log_to_search.postcode_full}", headers: headers, params: {} - expect(page).to have_content(log_to_search.id) + expect(page).to have_link(log_to_search.id.to_s) logs.each do |log| - expect(page).not_to have_content(log.id) + expect(page).not_to have_link(log.id.to_s) end end @@ -365,10 +365,10 @@ RSpec.describe CaseLogsController, type: :request do it "displays all matching logs" do get "/logs?search=#{log_to_search.postcode_full}", headers: headers, params: {} - expect(page).to have_content(log_to_search.id) + expect(page).to have_link(log_to_search.id.to_s) expect(page).to have_content(matching_postcode_log.id) logs.each do |log| - expect(page).not_to have_content(log.id) + expect(page).not_to have_link(log.id.to_s) end end end @@ -391,9 +391,9 @@ RSpec.describe CaseLogsController, type: :request do it "doesn't display any logs" do get "/logs?search=foobar", headers:, params: {} logs.each do |log| - expect(page).not_to have_content(log.id) + expect(page).not_to have_link(log.id.to_s) end - expect(page).not_to have_content(log_to_search.id) + expect(page).not_to have_link(log_to_search.id.to_s) end end @@ -401,9 +401,9 @@ RSpec.describe CaseLogsController, type: :request do it "doesn't display any logs" do get "/logs?search=", headers:, params: {} logs.each do |log| - expect(page).not_to have_content(log.id) + expect(page).not_to have_link(log.id.to_s) end - expect(page).not_to have_content(log_to_search.id) + expect(page).not_to have_link(log_to_search.id.to_s) end end @@ -414,10 +414,10 @@ RSpec.describe CaseLogsController, type: :request do it "shows only logs matching both search and filters" do get "/logs?search=#{matching_postcode}&status[]=#{matching_status}", headers: headers, params: {} - expect(page).to have_content(log_matching_filter_and_search.id) - expect(page).not_to have_content(log_to_search.id) + expect(page).to have_link(log_matching_filter_and_search.id.to_s) + expect(page).not_to have_link(log_to_search.id.to_s) logs.each do |log| - expect(page).not_to have_content(log.id) + expect(page).not_to have_link(log.id.to_s) end end end