diff --git a/app/views/case_logs/index.html.erb b/app/views/case_logs/index.html.erb index 61d83ed84..e51be3c8a 100644 --- a/app/views/case_logs/index.html.erb +++ b/app/views/case_logs/index.html.erb @@ -4,6 +4,8 @@ <%= content_for(:title) %> +<%= render LogSearchComponent.new(current_user:, label: "Search by log ID, tenant code, property reference or postcode") %> +
<%= govuk_button_to "Create a new lettings log", case_logs_path %> @@ -13,7 +15,6 @@ <%= render partial: "log_filters" %> <% if @case_logs.present? %>
- <%= render LogSearchComponent.new(current_user:, label: "Search by log ID, tenant code, property reference or postcode") %> <%= render partial: "log_list", locals: { case_logs: @case_logs, title: "Logs", pagy: @pagy } %> <%== render partial: "pagy/nav", locals: { pagy: @pagy, item_name: "logs" } %>
diff --git a/spec/features/log_spec.rb b/spec/features/log_spec.rb index df7f84b63..40501898d 100644 --- a/spec/features/log_spec.rb +++ b/spec/features/log_spec.rb @@ -4,8 +4,8 @@ RSpec.describe "Log Features" do context "Searching for specific logs" do context "I am logged in" do let!(:user) { FactoryBot.create(:user, last_sign_in_at: Time.zone.now) } - let!(:log) { FactoryBot.create(:case_log) } - let!(:unwanted_logs) { FactoryBot.create_list(:case_log, 4) } + let!(:log) { FactoryBot.create(:case_log, owning_organisation: user.organisation) } + let!(:unwanted_logs) { FactoryBot.create_list(:case_log, 4, owning_organisation: user.organisation) } before do visit("/logs") @@ -24,7 +24,6 @@ RSpec.describe "Log Features" do it "displays log matching the search" do fill_in("search-field", with: log.id) click_button("Search") - expect(page).to have_content(log.id) expect(page).not_to have_content(unwanted_logs.first.id) end