Add academic years as an ActiveRecord object

This commit is contained in:
Alex Basson 2021-09-21 12:15:53 -04:00
parent a7de5b9ac2
commit e222edc7e7
10 changed files with 47 additions and 11 deletions

View file

@ -11,7 +11,7 @@ feature "School dashboard", type: feature do
let(:measure_row_bars) { page.all('rect.measure-row-bar') }
let(:ay_2020_21) { '2020-21' }
let(:ay_2020_21) { AcademicYear.find_by_range '2020-21' }
before :each do
SurveyItemResponse.create response_id: '123abc', academic_year: ay_2020_21, school: school, survey_item: survey_item_1_for_measure, likert_score: 4
@ -29,7 +29,7 @@ feature "School dashboard", type: feature do
scenario "User views a school dashboard" do
page.driver.browser.basic_authorize(username, password)
visit "/districts/winchester/schools/#{school.slug}/dashboard?year=#{ay_2020_21}"
visit "/districts/#{district.slug}/schools/#{school.slug}/dashboard?year=#{ay_2020_21.range}"
expect(page).to have_select('academic-year', selected: '2020 2021')
expect(page).to have_select('district', selected: 'Winchester')

View file

@ -4,8 +4,8 @@ describe SurveyResponseAggregator, type: :model do
let(:category) { SqmCategory.create }
let(:subcategory) { Subcategory.create sqm_category: category }
let(:ay_2020_21) { '2020-21' }
let(:ay_2021_22) { '2021-22' }
let(:ay_2020_21) { AcademicYear.find_by_range '2020-21' }
let(:ay_2021_22) { AcademicYear.find_by_range '2021-22' }
let(:school_a) { School.create name: 'School A' }
let(:school_b) { School.create name: 'School A' }