Rails.logger.info("Updating scheme #{original_attributes['scheme_code']} with owning_organisation: #{organisation.name}")
Rails.logger.info("Updating scheme #{original_attributes['scheme_code']} with owning_organisation: #{organisation.name}")
else
else
Rails.logger.info("Cannot update scheme #{original_attributes['scheme_code']} with owning_organisation: #{value}. Organisation with name #{value} is not in the database")
Rails.logger.info("Cannot update scheme #{original_attributes['scheme_code']} with owning_organisation: #{value}. Organisation with name #{value} is not in the database or is not related to current organisation")
expect(Rails.logger).toreceive(:info).with("Updating scheme S#{schemes[0].id} with service_name: Updated test name")
expect(Rails.logger).toreceive(:info).with("Updating scheme S#{schemes[0].id} with service_name: Updated test name")
expect(Rails.logger).toreceive(:info).with("Updating scheme S#{schemes[0].id} with sensitive: No")
expect(Rails.logger).toreceive(:info).with("Updating scheme S#{schemes[0].id} with sensitive: No")
expect(Rails.logger).toreceive(:info).with("Updating scheme S#{schemes[0].id} with scheme_type: Direct Access Hostel")
expect(Rails.logger).toreceive(:info).with("Updating scheme S#{schemes[0].id} with scheme_type: Direct Access Hostel")
@ -168,7 +178,7 @@ RSpec.describe "bulk_update" do
expect(Rails.logger).toreceive(:info).with("Cannot update scheme S#{schemes[2].id} with sensitive: Yse. 'Yse' is not a valid sensitive")
expect(Rails.logger).toreceive(:info).with("Cannot update scheme S#{schemes[2].id} with sensitive: Yse. 'Yse' is not a valid sensitive")
expect(Rails.logger).toreceive(:info).with("Cannot update scheme S#{schemes[2].id} with scheme_type: Direct access Hostel. 'Direct access Hostel' is not a valid scheme_type")
expect(Rails.logger).toreceive(:info).with("Cannot update scheme S#{schemes[2].id} with scheme_type: Direct access Hostel. 'Direct access Hostel' is not a valid scheme_type")
expect(Rails.logger).toreceive(:info).with("Cannot update scheme S#{schemes[2].id} with owning_organisation: non existing org. Organisation with name non existing org is not in the database")
expect(Rails.logger).toreceive(:info).with("Cannot update scheme S#{schemes[2].id} with owning_organisation: non existing org. Organisation with name non existing org is not in the database or is not related to current organisation")
expect(Rails.logger).toreceive(:info).with("Cannot update scheme S#{schemes[2].id} with arrangement_type: wrong answer. 'wrong answer' is not a valid arrangement_type")
expect(Rails.logger).toreceive(:info).with("Cannot update scheme S#{schemes[2].id} with arrangement_type: wrong answer. 'wrong answer' is not a valid arrangement_type")
expect(Rails.logger).toreceive(:info).with("Cannot update scheme S#{schemes[2].id} with primary_client_group: FD. 'FD' is not a valid primary_client_group")
expect(Rails.logger).toreceive(:info).with("Cannot update scheme S#{schemes[2].id} with primary_client_group: FD. 'FD' is not a valid primary_client_group")
expect(Rails.logger).toreceive(:info).with("Cannot update scheme S#{schemes[2].id} with has_other_client_group: no. 'no' is not a valid has_other_client_group")
expect(Rails.logger).toreceive(:info).with("Cannot update scheme S#{schemes[2].id} with has_other_client_group: no. 'no' is not a valid has_other_client_group")
@ -197,6 +207,8 @@ RSpec.describe "bulk_update" do
end
end
it"logs an error if a validation fails and processes the rest of the rows"do
it"logs an error if a validation fails and processes the rest of the rows"do
expect(Rails.logger).toreceive(:info).with("Updating scheme S#{schemes[0].id} with service_name: Updated test name")
expect(Rails.logger).toreceive(:info).with("Updating scheme S#{schemes[0].id} with service_name: Updated test name")
@ -218,7 +230,7 @@ RSpec.describe "bulk_update" do
expect(Rails.logger).toreceive(:info).with("Cannot update scheme S#{schemes[2].id} with sensitive: Yse. 'Yse' is not a valid sensitive")
expect(Rails.logger).toreceive(:info).with("Cannot update scheme S#{schemes[2].id} with sensitive: Yse. 'Yse' is not a valid sensitive")
expect(Rails.logger).toreceive(:info).with("Cannot update scheme S#{schemes[2].id} with scheme_type: Direct access Hostel. 'Direct access Hostel' is not a valid scheme_type")
expect(Rails.logger).toreceive(:info).with("Cannot update scheme S#{schemes[2].id} with scheme_type: Direct access Hostel. 'Direct access Hostel' is not a valid scheme_type")
expect(Rails.logger).toreceive(:info).with("Cannot update scheme S#{schemes[2].id} with owning_organisation: non existing org. Organisation with name non existing org is not in the database")
expect(Rails.logger).toreceive(:info).with("Cannot update scheme S#{schemes[2].id} with owning_organisation: non existing org. Organisation with name non existing org is not in the database or is not related to current organisation")
expect(Rails.logger).toreceive(:info).with("Cannot update scheme S#{schemes[2].id} with arrangement_type: wrong answer. 'wrong answer' is not a valid arrangement_type")
expect(Rails.logger).toreceive(:info).with("Cannot update scheme S#{schemes[2].id} with arrangement_type: wrong answer. 'wrong answer' is not a valid arrangement_type")
expect(Rails.logger).toreceive(:info).with("Cannot update scheme S#{schemes[2].id} with primary_client_group: FD. 'FD' is not a valid primary_client_group")
expect(Rails.logger).toreceive(:info).with("Cannot update scheme S#{schemes[2].id} with primary_client_group: FD. 'FD' is not a valid primary_client_group")
expect(Rails.logger).toreceive(:info).with("Cannot update scheme S#{schemes[2].id} with has_other_client_group: no. 'no' is not a valid has_other_client_group")
expect(Rails.logger).toreceive(:info).with("Cannot update scheme S#{schemes[2].id} with has_other_client_group: no. 'no' is not a valid has_other_client_group")