Skip to content

Commit

Permalink
Fix spec issues
Browse files Browse the repository at this point in the history
  • Loading branch information
vacabor committed Jul 29, 2024
1 parent 3019ab1 commit 6d93150
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
1 change: 1 addition & 0 deletions app/models/early_years_data.rb
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
class EarlyYearsData < ApplicationRecord
belongs_to :local_authority
end
14 changes: 7 additions & 7 deletions spec/requests/admin_early_years_data_upload_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,25 +65,25 @@
nursery_name: "Test Nursery",
urn: "1234567",
local_authority_id: "101",
nursery_address: "123 Test Street, Test Town, TE1 5ST",
nursery_address: "123 Test Street Test Town TE1 5ST",
primary_key_contact_email_address: "[email protected]",
secondary_contact_email_address: "[email protected]"
},
{
nursery_name: "Other Nursery",
urn: "9876543",
local_authority_id: "101",
nursery_address: "321 Test Street, Test Town, TE1 5ST",
nursery_address: "321 Test Street Test Town TE1 5ST",
primary_key_contact_email_address: "[email protected]",
secondary_contact_email_address: ""
secondary_contact_email_address: nil
}
]
end

let(:expected_records) do
rows.map do |row|
expected_row = row.dup
expected_row[:local_authourity] = local_authourity
expected_row[:local_authority] = local_authority
expected_row.delete :local_authority_id
expected_row
end
Expand All @@ -96,8 +96,8 @@
it "parses the rows and saves them as early years data records" do
aggregate_failures do
expect { perform_enqueued_jobs { upload } }.to change(EarlyYearsData, :count).by(2)
expect(EarlyYearsData.find(urn: "1234567")).to have_attributes(expected_records[0])
expect(EarlyYearsData.find(urn: "9876543")).to have_attributes(expected_records[1])
expect(EarlyYearsData.find_by_urn("1234567")).to have_attributes(expected_records[0])
expect(EarlyYearsData.find_by_urn("9876543")).to have_attributes(expected_records[1])
end
end

Expand All @@ -114,7 +114,7 @@
end

context "with rows with invalid primary email" do
let(:rows) { super().map { |row| row.merge(primary_key_contact_email_address: "") } }
let(:rows) { super().map { |row| row.merge(primary_key_contact_email_address: nil) } }

include_examples :no_upload
end
Expand Down

0 comments on commit 6d93150

Please sign in to comment.