sqm-dashboards/spec/system/sqm_application_spec.rb
rebuilt d4df7cbc06 Add scales to framework. Change calculations to first group and then
average those groupings and the way up the framework.  Likert scores for
a survey_item are averaged.  Then all the survey_items in a scale are
averaged.  Then student scales in a measure are averaged.  And teacher
scales in a measure are averaged.  Then the average of those two
calculations becomes the score for a measure.  Then the measures in a
subcategory are averaged.
2022-02-24 14:53:06 +01:00

60 lines
1.5 KiB
Ruby

require 'rails_helper'
describe 'SQM Application' do
let(:district) { create(:district) }
let(:school) { create(:school, district: district) }
let(:academic_year) { create(:academic_year) }
let(:category) { create(:category) }
let(:measure) { create(:measure) }
let(:scale) {create(:scale, measure:)}
before :each do
driven_by :rack_test
page.driver.browser.basic_authorize(username, password)
end
context 'when no measures meet their threshold' do
it 'shows a modal on overview page' do
visit overview_path
expect(page).to have_css '.modal'
end
it 'does not show a modal on the browse page' do
visit browse_path
expect(page).not_to have_css '.modal'
end
end
context 'at least one measure meets its threshold' do
before :each do
teacher_survey_item = create(:teacher_survey_item, scale:)
create_list(:survey_item_response, SurveyItemResponse::TEACHER_RESPONSE_THRESHOLD,
survey_item: teacher_survey_item, academic_year: academic_year, school: school)
end
it 'does not show a modal on any page' do
[overview_path, browse_path].each do |path|
visit path
expect(page).not_to have_css '.modal'
end
end
end
private
def username
district.name.downcase
end
def password
"#{username}!"
end
def overview_path
district_school_overview_index_path(district, school, year: academic_year.range)
end
def browse_path
district_school_category_path(district, school, category, year: academic_year.range)
end
end