Add disaggregation by ELL

This commit is contained in:
rebuilt 2023-08-30 15:18:38 -07:00
parent 8d33095a48
commit 060d7aa55a
41 changed files with 707 additions and 376 deletions

View file

@ -1,33 +1,37 @@
require 'rails_helper'
require 'fileutils'
require "rails_helper"
require "fileutils"
RSpec.describe DisaggregationLoader do
let(:path) do
Rails.root.join('spec', 'fixtures', 'disaggregation')
Rails.root.join("spec", "fixtures", "disaggregation")
end
let(:academic_year) { create(:academic_year, range: '2022-23') }
let(:district) { create(:district, name: 'Maynard Public Schools') }
context '.load' do
it 'loads data from the file into a hash' do
let(:academic_year) { create(:academic_year, range: "2022-23") }
let(:district) { create(:district, name: "Maynard Public Schools") }
context ".load" do
it "loads data from the file into a hash" do
data = DisaggregationLoader.new(path:).load
expect(data.values.first.lasid).to eq('1')
expect(data.values.first.academic_year).to eq('2022-23')
expect(data.values.first.district).to eq('Maynard Public Schools')
expect(data.values.first.income).to eq('Free Lunch')
expect(data.values.first.lasid).to eq("1")
expect(data.values.first.academic_year).to eq("2022-23")
expect(data.values.first.district).to eq("Maynard Public Schools")
expect(data.values.last.lasid).to eq('500')
expect(data.values.last.academic_year).to eq('2022-23')
expect(data.values.last.district).to eq('Maynard Public Schools')
expect(data.values.last.income).to eq('Not Eligible')
expect(data.values.last.lasid).to eq("500")
expect(data.values.last.academic_year).to eq("2022-23")
expect(data.values.last.district).to eq("Maynard Public Schools")
end
expect(data[['1', 'Maynard Public Schools', '2022-23']].income).to eq('Free Lunch')
expect(data[['2', 'Maynard Public Schools', '2022-23']].income).to eq('Not Eligible')
expect(data[['3', 'Maynard Public Schools', '2022-23']].income).to eq('Reduced Lunch')
it "loads income data" do
data = DisaggregationLoader.new(path:).load
expect(data.values.first.raw_income).to eq("Free Lunch")
expect(data.values.last.raw_income).to eq("Not Eligible")
expect(data[["1", "Maynard Public Schools", "2022-23"]].raw_income).to eq("Free Lunch")
expect(data[["2", "Maynard Public Schools", "2022-23"]].raw_income).to eq("Not Eligible")
expect(data[["3", "Maynard Public Schools", "2022-23"]].raw_income).to eq("Reduced Lunch")
end
end
context 'Creating a new loader' do
it 'creates a directory for the loader file' do
context "Creating a new loader" do
it "creates a directory for the loader file" do
DisaggregationLoader.new(path:)
expect(path).to exist
end