The objective of this test case is to evaluate your ability to import data from a CSV file generated by the generate_comments_csv.rb script. You have to assume that the provided blog application is a production environment running application and must consider all scenarios relevant for this situation.
A running instance of the Rails blog application. The generate_comments_csv.rb script has been executed and a comments.csv file has been generated. The comments.csv file is located in the root directory of the Rails application.
Create a Rubt script to handle the import of comments from the CSV file into the Rails application. The task should:
- Read the comments.csv file.
- For each row in the CSV, find the corresponding Post by its slug.
- Create a new Comment associated with the found Post
- Handle and report any validation errors.
A perfectly written script is not important, however, considerations must be made for this being an active production environment. This includes things like validation failures and what the users may experience while the import is running.
The point is to be prepared during the technical interview to answer as many edge case questions about the script, strengths and weaknesses of your approach