|
|
|
@ -505,13 +505,34 @@ RSpec.describe SurveyItemValues, type: :model do
|
|
|
|
expect(values.income).to eq "Economically Disadvantaged - N"
|
|
|
|
expect(values.income).to eq "Economically Disadvantaged - N"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
it "translates blanks to Unknown" do
|
|
|
|
it "translates ones to Economically Disadvantaged - Y" do
|
|
|
|
headers = ["LowIncome"]
|
|
|
|
headers = ["LowIncome"]
|
|
|
|
row = { "LowIncome" => "" }
|
|
|
|
row = { "LowIncome" => "1" }
|
|
|
|
|
|
|
|
values = SurveyItemValues.new(row:, headers:, survey_items:, schools:, academic_years:)
|
|
|
|
|
|
|
|
expect(values.income).to eq "Economically Disadvantaged - Y"
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "translates zeros to Economically Disadvantaged - N" do
|
|
|
|
|
|
|
|
headers = ["LowIncome"]
|
|
|
|
|
|
|
|
row = { "LowIncome" => "0" }
|
|
|
|
values = SurveyItemValues.new(row:, headers:, survey_items:, schools:, academic_years:)
|
|
|
|
values = SurveyItemValues.new(row:, headers:, survey_items:, schools:, academic_years:)
|
|
|
|
|
|
|
|
expect(values.income).to eq "Economically Disadvantaged - N"
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "translates blanks to Unknown" do
|
|
|
|
|
|
|
|
headers = ["LowIncome"]
|
|
|
|
|
|
|
|
row = { "LowIncome" => "" }
|
|
|
|
|
|
|
|
values = SurveyItemValues.new(row:, headers:, survey_items:, schools:)
|
|
|
|
expect(values.income).to eq "Unknown"
|
|
|
|
expect(values.income).to eq "Unknown"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# NOTE: This will halt test runs too
|
|
|
|
|
|
|
|
# it "halts execution if there is a value it cannot parse" do
|
|
|
|
|
|
|
|
# headers = ["LowIncome"]
|
|
|
|
|
|
|
|
# row = { "LowIncome" => "ArbitraryUnknownValue" }
|
|
|
|
|
|
|
|
# output = capture_stdout { SurveyItemValues.new(row:, headers:, survey_items:, schools:) }
|
|
|
|
|
|
|
|
# expect(output).to match "ArbitraryUnknownValue is not a known value. Halting execution"
|
|
|
|
|
|
|
|
# end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
context ".ell" do
|
|
|
|
context ".ell" do
|
|
|
|
@ -530,8 +551,20 @@ RSpec.describe SurveyItemValues, type: :model do
|
|
|
|
values = SurveyItemValues.new(row:, headers:, survey_items:, schools:, academic_years:)
|
|
|
|
values = SurveyItemValues.new(row:, headers:, survey_items:, schools:, academic_years:)
|
|
|
|
expect(values.ell).to eq "ELL"
|
|
|
|
expect(values.ell).to eq "ELL"
|
|
|
|
|
|
|
|
|
|
|
|
row = { "Raw ELL" => "LEP Student Not 1st Year" }
|
|
|
|
row = { "Raw ELL" => "LEP Student, Not 1st Year" }
|
|
|
|
values = SurveyItemValues.new(row:, headers:, survey_items:, schools:, academic_years:)
|
|
|
|
values = SurveyItemValues.new(row:, headers:, survey_items:, schools:)
|
|
|
|
|
|
|
|
expect(values.ell).to eq "ELL"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
row = { "Raw ELL" => "EL student, not 1st year" }
|
|
|
|
|
|
|
|
values = SurveyItemValues.new(row:, headers:, survey_items:, schools:)
|
|
|
|
|
|
|
|
expect(values.ell).to eq "ELL"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
row = { "Raw ELL" => "EL student, 1st year" }
|
|
|
|
|
|
|
|
values = SurveyItemValues.new(row:, headers:, survey_items:, schools:)
|
|
|
|
|
|
|
|
expect(values.ell).to eq "ELL"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
row = { "Raw ELL" => "EL - Early Child. or PK" }
|
|
|
|
|
|
|
|
values = SurveyItemValues.new(row:, headers:, survey_items:, schools:)
|
|
|
|
expect(values.ell).to eq "ELL"
|
|
|
|
expect(values.ell).to eq "ELL"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
@ -546,16 +579,40 @@ RSpec.describe SurveyItemValues, type: :model do
|
|
|
|
expect(values.ell).to eq "Not ELL"
|
|
|
|
expect(values.ell).to eq "Not ELL"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
it 'tranlsates blanks into "Not Ell"' do
|
|
|
|
it 'tranlsates zeros into "Not ELL"' do
|
|
|
|
|
|
|
|
headers = ["Raw ELL"]
|
|
|
|
|
|
|
|
row = { "Raw ELL" => "0" }
|
|
|
|
|
|
|
|
values = SurveyItemValues.new(row:, headers:, survey_items:, schools:)
|
|
|
|
|
|
|
|
expect(values.ell).to eq "Not ELL"
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it 'tranlsates NAs and blanks into "Not ELL"' do
|
|
|
|
headers = ["Raw ELL"]
|
|
|
|
headers = ["Raw ELL"]
|
|
|
|
row = { "Raw ELL" => "" }
|
|
|
|
row = { "Raw ELL" => "" }
|
|
|
|
values = SurveyItemValues.new(row:, headers:, survey_items:, schools:, academic_years:)
|
|
|
|
values = SurveyItemValues.new(row:, headers:, survey_items:, schools:, academic_years:)
|
|
|
|
expect(values.ell).to eq "Not ELL"
|
|
|
|
expect(values.ell).to eq "Not ELL"
|
|
|
|
|
|
|
|
|
|
|
|
row = { "Raw ELL" => "Anything else" }
|
|
|
|
row = { "Raw ELL" => "NA" }
|
|
|
|
values = SurveyItemValues.new(row:, headers:, survey_items:, schools:, academic_years:)
|
|
|
|
values = SurveyItemValues.new(row:, headers:, survey_items:, schools:)
|
|
|
|
|
|
|
|
expect(values.ell).to eq "Not ELL"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
row = { "Raw ELL" => "#NA" }
|
|
|
|
|
|
|
|
values = SurveyItemValues.new(row:, headers:, survey_items:, schools:)
|
|
|
|
|
|
|
|
expect(values.ell).to eq "Not ELL"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
row = { "Raw ELL" => "#N/A" }
|
|
|
|
|
|
|
|
values = SurveyItemValues.new(row:, headers:, survey_items:, schools:)
|
|
|
|
expect(values.ell).to eq "Not ELL"
|
|
|
|
expect(values.ell).to eq "Not ELL"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# NOTE: This will halt test runs too
|
|
|
|
|
|
|
|
# it "halts execution if there is a value it cannot parse" do
|
|
|
|
|
|
|
|
# headers = ["Raw ELL"]
|
|
|
|
|
|
|
|
# row = { "Raw ELL" => "ArbitraryUnknownValue" }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# output = capture_stdout { SurveyItemValues.new(row:, headers:, survey_items:, schools:) }
|
|
|
|
|
|
|
|
# expect(output).to match "ArbitraryUnknownValue is not a known value. Halting execution"
|
|
|
|
|
|
|
|
# end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
context ".sped" do
|
|
|
|
context ".sped" do
|
|
|
|
@ -571,6 +628,34 @@ RSpec.describe SurveyItemValues, type: :model do
|
|
|
|
expect(values.sped).to eq "Special Education"
|
|
|
|
expect(values.sped).to eq "Special Education"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it 'translates "1" into "Special Education"' do
|
|
|
|
|
|
|
|
headers = ["Raw SpEd"]
|
|
|
|
|
|
|
|
row = { "Raw SpEd" => "1" }
|
|
|
|
|
|
|
|
values = SurveyItemValues.new(row:, headers:, survey_items:, schools:, academic_years:)
|
|
|
|
|
|
|
|
expect(values.sped).to eq "Special Education"
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it 'translates "A" into "Special Education"' do
|
|
|
|
|
|
|
|
headers = ["Raw SpEd"]
|
|
|
|
|
|
|
|
row = { "Raw SpEd" => "A" }
|
|
|
|
|
|
|
|
values = SurveyItemValues.new(row:, headers:, survey_items:, schools:, academic_years:)
|
|
|
|
|
|
|
|
expect(values.sped).to eq "Special Education"
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it 'translates "I" into "Not Special Education"' do
|
|
|
|
|
|
|
|
headers = ["Raw SpEd"]
|
|
|
|
|
|
|
|
row = { "Raw SpEd" => "I" }
|
|
|
|
|
|
|
|
values = SurveyItemValues.new(row:, headers:, survey_items:, schools:, academic_years:)
|
|
|
|
|
|
|
|
expect(values.sped).to eq "Not Special Education"
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it 'translates "0" into "Not Special Education"' do
|
|
|
|
|
|
|
|
headers = ["Raw SpEd"]
|
|
|
|
|
|
|
|
row = { "Raw SpEd" => "0" }
|
|
|
|
|
|
|
|
values = SurveyItemValues.new(row:, headers:, survey_items:, schools:, academic_years:)
|
|
|
|
|
|
|
|
expect(values.sped).to eq "Not Special Education"
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
it 'translates "exited" into "Not Special Education"' do
|
|
|
|
it 'translates "exited" into "Not Special Education"' do
|
|
|
|
headers = ["Raw SpEd"]
|
|
|
|
headers = ["Raw SpEd"]
|
|
|
|
row = { "Raw SpEd" => "exited" }
|
|
|
|
row = { "Raw SpEd" => "exited" }
|
|
|
|
@ -585,7 +670,7 @@ RSpec.describe SurveyItemValues, type: :model do
|
|
|
|
expect(values.sped).to eq "Not Special Education"
|
|
|
|
expect(values.sped).to eq "Not Special Education"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
it 'tranlsates NA into "Not Special Education"' do
|
|
|
|
it 'translates NA into "Not Special Education"' do
|
|
|
|
headers = ["Raw SpEd"]
|
|
|
|
headers = ["Raw SpEd"]
|
|
|
|
row = { "Raw SpEd" => "NA" }
|
|
|
|
row = { "Raw SpEd" => "NA" }
|
|
|
|
values = SurveyItemValues.new(row:, headers:, survey_items:, schools:, academic_years:)
|
|
|
|
values = SurveyItemValues.new(row:, headers:, survey_items:, schools:, academic_years:)
|
|
|
|
@ -595,6 +680,14 @@ RSpec.describe SurveyItemValues, type: :model do
|
|
|
|
values = SurveyItemValues.new(row:, headers:, survey_items:, schools:, academic_years:)
|
|
|
|
values = SurveyItemValues.new(row:, headers:, survey_items:, schools:, academic_years:)
|
|
|
|
expect(values.sped).to eq "Not Special Education"
|
|
|
|
expect(values.sped).to eq "Not Special Education"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# NOTE: This will halt test runs too
|
|
|
|
|
|
|
|
# it "halts execution if there is a value it cannot parse" do
|
|
|
|
|
|
|
|
# headers = ["Raw SpEd"]
|
|
|
|
|
|
|
|
# row = { "Raw SpEd" => "ArbitraryUnknownValue" }
|
|
|
|
|
|
|
|
# output = capture_stdout { SurveyItemValues.new(row:, headers:, survey_items:, schools:) }
|
|
|
|
|
|
|
|
# expect(output).to match "ArbitraryUnknownValue is not a known value. Halting execution"
|
|
|
|
|
|
|
|
# end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
context ".valid_duration" do
|
|
|
|
context ".valid_duration" do
|
|
|
|
|