diff --git a/app/controllers/lettings_logs_controller.rb b/app/controllers/lettings_logs_controller.rb index 169ff42e3..6b1d4a531 100644 --- a/app/controllers/lettings_logs_controller.rb +++ b/app/controllers/lettings_logs_controller.rb @@ -118,7 +118,7 @@ private end def redirect_if_bulk_upload_resolved - if @bulk_upload && @bulk_upload.lettings_logs.in_progress.count.zero? + if @bulk_upload && @bulk_upload.lettings? && @bulk_upload.lettings_logs.in_progress.count.zero? redirect_to resume_bulk_upload_lettings_result_path(@bulk_upload) end end diff --git a/spec/controllers/lettings_logs_controller_spec.rb b/spec/controllers/lettings_logs_controller_spec.rb new file mode 100644 index 000000000..0874649e7 --- /dev/null +++ b/spec/controllers/lettings_logs_controller_spec.rb @@ -0,0 +1,21 @@ +require "rails_helper" + +RSpec.describe LettingsLogsController do + before do + sign_in bulk_upload.user + end + + describe "#index" do + context "when a sales bulk upload filter is applied" do + let(:bulk_upload) { create(:bulk_upload, :sales) } + + it "does not redirect to resume path" do + session[:logs_filters] = { bulk_upload_id: [bulk_upload.id.to_s] }.to_json + + get :index + + expect(response).to be_successful + end + end + end +end