Skip to content

Commit

Permalink
[7650] Amended to read csv as hash
Browse files Browse the repository at this point in the history
  • Loading branch information
defong committed Oct 17, 2024
1 parent 4765e23 commit 4b6ecab
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 8 deletions.
2 changes: 0 additions & 2 deletions spec/fixtures/files/hpitt_degree_import.csv

This file was deleted.

40 changes: 34 additions & 6 deletions spec/services/degrees/create_from_csv_row_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,40 @@ module Degrees
let(:trainee) { create(:trainee) }
let(:degree) { trainee.degrees.first }
let(:csv_row) do
CSV.read(
file_fixture("hpitt_degree_import.csv").to_path,
headers: true,
encoding: "ISO-8859-1",
header_converters: ->(f) { f&.strip },
).first
{ "Provider trainee ID" => "A2",
"Region" => "London",
"First names" => "Adam",
"Middle names" => nil,
"Last names" => "Test",
"Date of birth" => "21/09/1997",
"Sex" => "Male",
"Nationality" => "british",
"UK address: Line 1" => "99 Lovely Road",
"UK address: Line 2" => nil,
"UK address: town or city" => "Oxford",
"UK Address 1: Postcode" => "OX41RG",
"Outside UK address" => nil,
"Email" => "[email protected]",
"Ethnicity" => "White - English, Scottish, Welsh, Northern Irish or British",
"Disabilities" => "Not provided",
"Course level" => nil,
"Course education phase" => "Secondary",
"Course age range" => "11 to 16",
"Course ITT subject 1" => "Mathematics",
"Course ITT subject 2" => nil,
"Course ITT Subject 3" => nil,
"Course study mode" => "full-time",
"Course ITT start date" => "2022-09-09",
"Course Expected End Date" => "31/07/2023",
"Trainee start date" => "09/09/2022",
"Employing school URN" => "131609",
"Degree: country" => "United Kingdom",
"Degree: subjects" => "Philosophy, Politics, Economics",
"Degree: UK degree types" => "Bachelor of Arts",
"Degree: UK awarding institution" => "University of Oxford",
"Degree: UK grade" => "Upper second-class honours (2:1)",
"Degree: Non-UK degree types" => nil,
"Degree: graduation year" => "2018" }
end

describe "#call" do
Expand Down

0 comments on commit 4b6ecab

Please sign in to comment.