Browse Source

prevent sales log affecting lettings redirect

bu-sales-23-v3
Phil Lee 2 years ago
parent
commit
1467995cb1
  1. 2
      app/controllers/lettings_logs_controller.rb
  2. 21
      spec/controllers/lettings_logs_controller_spec.rb

2
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

21
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
Loading…
Cancel
Save