mirror of
https://github.com/edcommonwealth/sqm-dashboards.git
synced 2026-03-07 21:48:16 -08:00
parent
340bdad831
commit
000bb52e1d
16 changed files with 239 additions and 191 deletions
|
|
@ -1,10 +1,12 @@
|
|||
FactoryBot.define do
|
||||
factory :sqm_category do
|
||||
name { "A category" }
|
||||
description { "A description of a category" }
|
||||
end
|
||||
|
||||
factory :subcategory do
|
||||
name { "A subcategory" }
|
||||
description { "A description of a subcategory" }
|
||||
sqm_category
|
||||
|
||||
factory :subcategory_with_measures do
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ describe CategoryPresenter do
|
|||
subcategory1 = Subcategory.new(name: 'A subcategory')
|
||||
subcategory2 = Subcategory.new(name: 'Another subcategory')
|
||||
|
||||
category = SqmCategory.new(name: 'Some Category', subcategories: [subcategory1, subcategory2])
|
||||
category = SqmCategory.new(name: 'Some Category', description: 'Some category description', subcategories: [subcategory1, subcategory2])
|
||||
return CategoryPresenter.new(category: category, academic_year: AcademicYear.new, school: School.new)
|
||||
end
|
||||
|
||||
|
|
@ -13,6 +13,10 @@ describe CategoryPresenter do
|
|||
expect(category_presenter.name).to eq 'Some Category'
|
||||
end
|
||||
|
||||
it 'returns the description of the category' do
|
||||
expect(category_presenter.description).to eq 'Some category description'
|
||||
end
|
||||
|
||||
it 'maps subcategories to subcategory presenters' do
|
||||
expect(category_presenter.subcategories.map(&:name)).to eq ['A subcategory', 'Another subcategory']
|
||||
end
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ describe SubcategoryPresenter do
|
|||
let(:academic_year) { create(:academic_year, range: '1989-90') }
|
||||
let(:school) { create(:school, name: 'Best School') }
|
||||
let(:subcategory_presenter) do
|
||||
subcategory = create(:subcategory, name: 'A great subcategory')
|
||||
subcategory = create(:subcategory, name: 'A great subcategory', description: 'A great description')
|
||||
|
||||
measure1 = create(:measure, watch_low_benchmark: 4, growth_low_benchmark: 4.25, approval_low_benchmark: 4.5, ideal_low_benchmark: 4.75, subcategory: subcategory)
|
||||
survey_item1 = create(:survey_item, measure: measure1)
|
||||
|
|
@ -25,6 +25,10 @@ describe SubcategoryPresenter do
|
|||
expect(subcategory_presenter.name).to eq 'A great subcategory'
|
||||
end
|
||||
|
||||
it 'returns the description of the subcategory' do
|
||||
expect(subcategory_presenter.description).to eq 'A great description'
|
||||
end
|
||||
|
||||
it 'returns a gauge presenter responsible for the aggregate survey item response likert scores' do
|
||||
expect(subcategory_presenter.gauge_presenter.title).to eq 'Growth'
|
||||
end
|
||||
|
|
|
|||
|
|
@ -5,10 +5,10 @@ describe 'browse/show.html.erb' do
|
|||
academic_year = create(:academic_year, range: '1989-90')
|
||||
school = create(:school, name: 'Best School')
|
||||
|
||||
category = create(:sqm_category, name: 'Some Category')
|
||||
category = create(:sqm_category, name: 'Some Category', description: 'Some description of the category')
|
||||
|
||||
subcategory1 = create(:subcategory, sqm_category: category, name: 'A subcategory')
|
||||
subcategory2 = create(:subcategory_with_measures, sqm_category: category, name: 'Another subcategory')
|
||||
subcategory1 = create(:subcategory, sqm_category: category, name: 'A subcategory', description: 'Some description of the subcategory')
|
||||
subcategory2 = create(:subcategory_with_measures, sqm_category: category, name: 'Another subcategory', description: 'Another description of the subcategory')
|
||||
|
||||
measure1 = create(:measure, subcategory: subcategory1, watch_low_benchmark: 1.5, growth_low_benchmark: 2.5, approval_low_benchmark: 3.5, ideal_low_benchmark: 4.5)
|
||||
|
||||
|
|
@ -21,8 +21,9 @@ describe 'browse/show.html.erb' do
|
|||
render
|
||||
end
|
||||
|
||||
it 'renders the category name' do
|
||||
it 'renders the category name and description' do
|
||||
expect(rendered).to match /Some Category/
|
||||
expect(rendered).to match /Some description of the category/
|
||||
end
|
||||
|
||||
context 'for each subcategory' do
|
||||
|
|
@ -31,6 +32,11 @@ describe 'browse/show.html.erb' do
|
|||
expect(rendered).to match /Another subcategory/
|
||||
end
|
||||
|
||||
it 'renders the subcategory description' do
|
||||
expect(rendered).to match /Some description of the subcategory/
|
||||
expect(rendered).to match /Another description of the subcategory/
|
||||
end
|
||||
|
||||
it 'renders the zone title and fill color for the gauge graph' do
|
||||
expect(rendered).to match /Growth/
|
||||
expect(rendered).to match /fill-growth/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue