Browse Source

feature using logs from the same org

pull/608/head
JG 3 years ago
parent
commit
5ef5c5c089
  1. 3
      app/views/case_logs/index.html.erb
  2. 5
      spec/features/log_spec.rb

3
app/views/case_logs/index.html.erb

@ -4,6 +4,8 @@
<%= content_for(:title) %>
</h1>
<%= render LogSearchComponent.new(current_user:, label: "Search by log ID, tenant code, property reference or postcode") %>
<div class="app-filter-layout" data-controller="filter-layout">
<div class="govuk-button-group app-filter-toggle">
<%= govuk_button_to "Create a new lettings log", case_logs_path %>
@ -13,7 +15,6 @@
<%= render partial: "log_filters" %>
<% if @case_logs.present? %>
<div class="app-filter-layout__content">
<%= 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" } %>
</div>

5
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

Loading…
Cancel
Save