|
|
|
@ -1,23 +1,39 @@
|
|
|
|
require 'rails_helper'
|
|
|
|
require 'rails_helper'
|
|
|
|
RSpec.describe Dese::Loader do
|
|
|
|
RSpec.describe Dese::Loader do
|
|
|
|
let(:path_to_admin_data) { Rails.root.join('spec', 'fixtures', 'sample_four_d_data.csv') }
|
|
|
|
let(:path_to_admin_data) { Rails.root.join('spec', 'fixtures', 'sample_four_d_data.csv') }
|
|
|
|
let(:ay_2020_21) { AcademicYear.find_by_range '2020-21' }
|
|
|
|
|
|
|
|
let(:ay_2018_19) { AcademicYear.find_by_range '2018-19' }
|
|
|
|
let(:ay_2022_23) { create(:academic_year, range: '2022-23') }
|
|
|
|
let(:ay_2017_18) { AcademicYear.find_by_range '2017-18' }
|
|
|
|
let(:ay_2021_22) { create(:academic_year, range: '2021-22') }
|
|
|
|
let(:ay_2016_17) { AcademicYear.find_by_range '2016-17' }
|
|
|
|
let(:ay_2020_21) { create(:academic_year, range: '2020-21') }
|
|
|
|
let(:four_d) { AdminDataItem.find_by_admin_data_item_id 'a-cgpr-i1' }
|
|
|
|
let(:ay_2019_20) { create(:academic_year, range: '2019-20') }
|
|
|
|
let(:attleboro) { School.find_by_dese_id 160_505 }
|
|
|
|
let(:ay_2018_19) { create(:academic_year, range: '2018-19') }
|
|
|
|
let(:winchester) { School.find_by_dese_id 3_440_505 }
|
|
|
|
let(:ay_2017_18) { create(:academic_year, range: '2017-18') }
|
|
|
|
let(:milford) { School.find_by_dese_id 1_850_505 }
|
|
|
|
let(:ay_2016_17) { create(:academic_year, range: '2016-17') }
|
|
|
|
let(:seacoast) { School.find_by_dese_id 2_480_520 }
|
|
|
|
let(:four_d) { create(:admin_data_item, admin_data_item_id: 'a-cgpr-i1') }
|
|
|
|
let(:next_wave) { School.find_by_dese_id 2_740_510 }
|
|
|
|
let(:attleboro) { create(:school, dese_id: 160_505) }
|
|
|
|
|
|
|
|
let(:winchester) { create(:school, dese_id: 3_440_505) }
|
|
|
|
|
|
|
|
let(:milford) { create(:school, dese_id: 1_850_505) }
|
|
|
|
|
|
|
|
let(:seacoast) { create(:school, dese_id: 2_480_520) }
|
|
|
|
|
|
|
|
let(:next_wave) { create(:school, dese_id: 2_740_510) }
|
|
|
|
|
|
|
|
|
|
|
|
before :each do
|
|
|
|
before :each do
|
|
|
|
Rails.application.load_seed
|
|
|
|
ay_2022_23
|
|
|
|
|
|
|
|
ay_2021_22
|
|
|
|
|
|
|
|
ay_2020_21
|
|
|
|
|
|
|
|
ay_2019_20
|
|
|
|
|
|
|
|
ay_2018_19
|
|
|
|
|
|
|
|
ay_2017_18
|
|
|
|
|
|
|
|
ay_2016_17
|
|
|
|
|
|
|
|
four_d
|
|
|
|
|
|
|
|
attleboro
|
|
|
|
|
|
|
|
winchester
|
|
|
|
|
|
|
|
milford
|
|
|
|
|
|
|
|
seacoast
|
|
|
|
|
|
|
|
next_wave
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
after :each do
|
|
|
|
after :each do
|
|
|
|
DatabaseCleaner.clean
|
|
|
|
# DatabaseCleaner.clean
|
|
|
|
end
|
|
|
|
end
|
|
|
|
context 'when running the loader' do
|
|
|
|
context 'when running the loader' do
|
|
|
|
before :each do
|
|
|
|
before :each do
|
|
|
|
@ -38,13 +54,13 @@ RSpec.describe Dese::Loader do
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
it 'loads the correct number of items' do
|
|
|
|
it 'loads the correct number of items' do
|
|
|
|
expect(AdminDataValue.count).to eq 230
|
|
|
|
expect(AdminDataValue.count).to eq 25
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
it 'is idempotent' do
|
|
|
|
it 'is idempotent' do
|
|
|
|
Dese::Loader.load_data filepath: path_to_admin_data
|
|
|
|
Dese::Loader.load_data filepath: path_to_admin_data
|
|
|
|
|
|
|
|
|
|
|
|
expect(AdminDataValue.count).to eq 230
|
|
|
|
expect(AdminDataValue.count).to eq 25
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|