Skip to content

Commit

Permalink
Merge pull request #1844 from Crown-Commercial-Service/fix-minor-issu…
Browse files Browse the repository at this point in the history
…es-with-mcf4

Fix minor issues with MCF4
  • Loading branch information
tim-s-ccs authored Feb 25, 2025
2 parents 9da3703 + a2718dc commit c2810e6
Show file tree
Hide file tree
Showing 5 changed files with 113 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ def authorize_user
KEY_TO_MODEL = {
st_rm6238_upload_id: SupplyTeachers::RM6238::Admin::Upload,
mc_rm6187_upload_id: ManagementConsultancy::RM6187::Admin::Upload,
mc_rm6309_upload_id: ManagementConsultancy::RM6309::Admin::Upload,
ls_rm6240_upload_id: LegalServices::RM6240::Admin::Upload
}.freeze
end
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,9 @@ def add_rate_cards_to_suppliers(rate_cards_workbook)
rate_card_a[:director_rate_in_pence] = convert_price(row[11])
rate_card_b[:director_rate_in_pence] = convert_price(row[12])

lot_contact_details[:contact_name] = row[7]
lot_contact_details[:email] = row[8]
lot_contact_details[:telephone_number] = row[9]
lot_contact_details[:contact_name] = row[13]
lot_contact_details[:email] = row[14]
lot_contact_details[:telephone_number] = row[15]

supplier['rate_cards'] << rate_card_a
supplier['rate_cards'] << rate_card_b
Expand Down
4 changes: 2 additions & 2 deletions config/locales/views/management_consultancy.en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -256,10 +256,10 @@ en:
supplier_missing_rate_cards_html: 'The following suppliers do not have any rate cards: %{list} Make sure all the suppliers have the correct name and DUNS number'
supplier_rate_cards_has_empty_sheets_html: 'The following sheets have no data: %{list} Make sure all sheets for ''Supplier rate cards'' have been filled in'
supplier_rate_cards_has_incorrect_headers_html: 'The following sheets are missing columns: %{list} Make sure all sheets for ''Supplier rate cards'' have the 10 expected columns'
supplier_rate_cards_missing_sheets: 'The ''Supplier rate cards'' file should have 9 sheets with the following names: ''MCF4 Lot 1'', ''MCF4 Lot 2'', ''MCF4 Lot 3'', ''MCF4 Lot 4'', ''MCF4 Lot 5'', ''MCF4 Lot 6'', ''MCF4 Lot 7'', ''MCF4 Lot 8'', ''MCF4 Lot 9'''
supplier_rate_cards_missing_sheets: 'The ''Supplier rate cards'' file should have 9 sheets with the following names: ''MCF4 Lot 1'', ''MCF4 Lot 2'', ''MCF4 Lot 3'', ''MCF4 Lot 4'', ''MCF4 Lot 5'', ''MCF4 Lot 6'', ''MCF4 Lot 7'', ''MCF4 Lot 8'', ''MCF4 Lot 9'', ''MCF4 Lot 10'''
supplier_service_offerings_has_empty_sheets_html: 'The following sheets have no data: %{list} Make sure all sheets for ''Supplier service offerings'' have been filled in'
supplier_service_offerings_has_incorrect_headers_html: 'The following sheets have incorrect column headers: %{list} Make sure all sheets for ''Supplier service offerings'' have the correct services for their lot'
supplier_service_offerings_missing_sheets: 'The ''Supplier service offerings'' file should have 9 sheets with the following names: ''MCF4 Lot 1'', ''MCF4 Lot 2'', ''MCF4 Lot 3'', ''MCF4 Lot 4'', ''MCF4 Lot 5'', ''MCF4 Lot 6'', ''MCF4 Lot 7'', ''MCF4 Lot 8'', ''MCF4 Lot 9'''
supplier_service_offerings_missing_sheets: 'The ''Supplier service offerings'' file should have 9 sheets with the following names: ''MCF4 Lot 1'', ''MCF4 Lot 2'', ''MCF4 Lot 3'', ''MCF4 Lot 4'', ''MCF4 Lot 5'', ''MCF4 Lot 6'', ''MCF4 Lot 7'', ''MCF4 Lot 8'', ''MCF4 Lot 9'', ''MCF4 Lot 10'''
upload_failed: Something went wrong with the file upload, please try uploading the files again
upload_failed_html: 'Something went wrong with the file upload, the following error was returned: <br> <strong>%{list}</strong>'
error_name:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Feature: Management Consultancy - Suppliers
Feature: Management Consultancy - Suppliers - Lot 10

Scenario Outline: Check the supplier data
Given I sign in and navigate to the start page for the 'RM6309' framework in 'management consultancy'
Expand Down
106 changes: 106 additions & 0 deletions spec/controllers/active_storage/blobs/redirect_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,112 @@
end
end

context 'when trying to download a management consultancy document in RM6309' do
let(:signed_id) { admin_upload.supplier_details_file.blob.signed_id }
let(:filename) { admin_upload.supplier_details_file.blob.filename }
let(:blob_object_id_key) { :mc_rm6309_upload_id }
let(:blob_object_id) { admin_upload.id }
let(:admin_upload) { create(:management_consultancy_rm6309_admin_upload_with_document) }

context 'when signed in as an st buyer' do
login_st_buyer

it 'redirects to the not permitted path' do
get :show

expect(response).to redirect_to supply_teachers_rm6238_not_permitted_path
end
end

context 'when signed in as an mc buyer' do
login_mc_buyer

it 'redirects to the not permitted path' do
get :show

expect(response).to redirect_to supply_teachers_rm6238_not_permitted_path
end
end

context 'when signed in as an ls buyer' do
login_ls_buyer

it 'redirects to the not permitted path' do
get :show

expect(response).to redirect_to supply_teachers_rm6238_not_permitted_path
end
end

context 'when signed in as an st admin' do
login_st_admin

it 'allows the blob to be downloaded' do
get :show

expect(response).to have_http_status(:found)
end
end

context 'when signed in as an mc admin' do
login_mc_admin

it 'allows the blob to be downloaded' do
get :show

expect(response).to have_http_status(:found)
end

context 'when the key is not passed' do
it 'redirects to the not permitted path' do
default_params.delete(:key)

get :show

expect(response).to redirect_to supply_teachers_rm6238_not_permitted_path
end
end

context 'when the value is not passed' do
it 'redirects to the not permitted path' do
default_params.delete(:value)

get :show

expect(response).to redirect_to supply_teachers_rm6238_not_permitted_path
end
end

context 'when the key is not valid' do
let(:blob_object_id_key) { :fake_procurement_id_key }

it 'redirects to the not permitted path' do
get :show

expect(response).to redirect_to supply_teachers_rm6238_not_permitted_path
end
end

context 'when the object does not exist' do
let(:blob_object_id) { SecureRandom.uuid }

it 'is raise a routing error' do
expect { get :show }.to raise_error(ActionController::RoutingError)
end
end
end

context 'when signed in as an ls admin' do
login_ls_admin

it 'allows the blob to be downloaded' do
get :show

expect(response).to have_http_status(:found)
end
end
end

context 'when trying to download a legal services document in RM6240' do
let(:signed_id) { admin_upload.supplier_details_file.blob.signed_id }
let(:filename) { admin_upload.supplier_details_file.blob.filename }
Expand Down

0 comments on commit c2810e6

Please sign in to comment.