Browse Source

Put bulk upload controller checks behind feature flag (#1712)

pull/1687/head v0.3.31
Jack 2 years ago committed by GitHub
parent
commit
de3e44459d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      app/controllers/bulk_upload_lettings_logs_controller.rb
  2. 7
      app/controllers/bulk_upload_sales_logs_controller.rb
  3. 12
      spec/requests/bulk_upload_lettings_logs_controller_spec.rb
  4. 12
      spec/requests/bulk_upload_sales_logs_controller_spec.rb

7
app/controllers/bulk_upload_lettings_logs_controller.rb

@ -25,9 +25,10 @@ class BulkUploadLettingsLogsController < ApplicationController
private
def validate_data_protection_agrement_signed!
unless @current_user.organisation.data_protection_confirmed?
redirect_to lettings_logs_path
end
return unless FeatureToggle.new_data_protection_confirmation?
return if @current_user.organisation.data_protection_confirmed?
redirect_to lettings_logs_path
end
def current_year

7
app/controllers/bulk_upload_sales_logs_controller.rb

@ -25,9 +25,10 @@ class BulkUploadSalesLogsController < ApplicationController
private
def validate_data_protection_agrement_signed!
unless @current_user.organisation.data_protection_confirmed?
redirect_to sales_logs_path
end
return unless FeatureToggle.new_data_protection_confirmation?
return if @current_user.organisation.data_protection_confirmed?
redirect_to sales_logs_path
end
def current_year

12
spec/requests/bulk_upload_lettings_logs_controller_spec.rb

@ -18,6 +18,18 @@ RSpec.describe BulkUploadLettingsLogsController, type: :request do
expect(response).to redirect_to("/lettings-logs")
end
context "when feature flag disabled" do
before do
allow(FeatureToggle).to receive(:new_data_protection_confirmation?).and_return(false)
end
it "does not redirect to lettings index page" do
get "/lettings-logs/bulk-upload-logs/start", params: {}
expect(response).not_to redirect_to("/lettings-logs")
end
end
end
context "when not in crossover period" do

12
spec/requests/bulk_upload_sales_logs_controller_spec.rb

@ -18,6 +18,18 @@ RSpec.describe BulkUploadSalesLogsController, type: :request do
expect(response).to redirect_to("/sales-logs")
end
context "when feature flag disabled" do
before do
allow(FeatureToggle).to receive(:new_data_protection_confirmation?).and_return(false)
end
it "does not redirect to lettings index page" do
get "/lettings-logs/bulk-upload-logs/start", params: {}
expect(response).not_to redirect_to("/sales-logs")
end
end
end
context "when not in crossover period" do

Loading…
Cancel
Save