pulibrary / lib_jobs

Enterprise Services batch processing tasks. Rails 7 Ruby 3.1.0
4 stars 0 forks source link

Ensure csv is always required #811

Closed maxkadel closed 3 months ago

maxkadel commented 3 months ago

Expected behavior

The code in production correctly guesses whether CSV is part of a class or not. We should consistently put requrie 'csv' at the top of files that use it, so that it always correctly resolves.

Actual behavior

Sometimes the code in production is not correctly guessing whether CSV belongs to the class it shows up in, or the top level CSV class.

Steps to replicate

Try to run the process_newly_cataloged_records rake task

Impact of this bug

Rake tasks will intermittently fail

Honeybadger link and code snippet, if applicable

Honeybadger link

NameError: uninitialized constant Oclc::LcCallSlips::SelectorCSV::CSV CSV.open(file_path, 'w', encoding: 'bom|utf-8') do |csv| ^^^ 

Implementation notes, if any

Add require 'csv' to any files that use the CSV class