Add missing tests. Remove unused code. Filter out legacy specs from code coverage report

pull/1/head
rebuilt 4 years ago
parent 3ae0d02462
commit e69f850cc5

@ -30,20 +30,6 @@ module GaugeHelper
Point.new(0, 0)
end
def indicator_tip
Point.new(arc_center.x, arc_center.y - outer_radius - 2)
end
def indicator_right_corner
Point.new(key_benchmark_indicator_gutter / Math.sqrt(3),
arc_center.y - outer_radius - key_benchmark_indicator_gutter)
end
def indicator_left_corner
Point.new(-key_benchmark_indicator_gutter / Math.sqrt(3),
arc_center.y - outer_radius - key_benchmark_indicator_gutter)
end
def arc_radius(radius)
"#{radius} #{radius}"
end
@ -90,10 +76,6 @@ module GaugeHelper
Point.new(x, y)
end
def rotation_angle_for(percentage:)
180.0 * percentage - 90
end
def coordinates_for(point)
"#{point.x} #{point.y}"
end

@ -40,9 +40,7 @@ class Measure < ActiveRecord::Base
end
def warning_low_benchmark
return @warning_low_benchmark unless @warning_low_benchmark.nil?
@warning_low_benchmark = benchmark(:warning_low_benchmark)
1
end
def watch_low_benchmark

@ -28,6 +28,10 @@ RSpec.describe Measure, type: :model do
it 'returns a watch low benchmark equal to the admin data item watch low benchmark' do
expect(measure.watch_low_benchmark).to be 2.0
end
it 'returns the source as an admin_data_item' do
expect(measure.sources).to eq [:admin_data]
end
end
context 'when a measure includes only student survey items' do
@ -41,6 +45,12 @@ RSpec.describe Measure, type: :model do
it 'returns a watch low benchmark equal to the student survey item watch low benchmark ' do
expect(measure.watch_low_benchmark).to be 1.5
end
it 'returns a warning low benchmark equal to the student survey item warning low benchmark ' do
expect(measure.warning_low_benchmark).to eq 1
end
it 'returns the source as student_surveys' do
expect(measure.sources).to eq [:student_surveys]
end
end
context 'when a measure includes only teacher survey items' do
@ -54,6 +64,12 @@ RSpec.describe Measure, type: :model do
it 'returns a watch low benchmark equal to the teacher survey item watch low benchmark ' do
expect(measure.watch_low_benchmark).to be 1.2
end
it 'returns a warning low benchmark equal to the teacher survey item warning low benchmark ' do
expect(measure.warning_low_benchmark).to eq 1
end
it 'returns the source as teacher_surveys' do
expect(measure.sources).to eq [:teacher_surveys]
end
end
context 'when a measure includes admin data and student survey items' do
@ -75,6 +91,9 @@ RSpec.describe Measure, type: :model do
# (2*3 + 1.5)/4
expect(measure.watch_low_benchmark).to be 1.875
end
it 'returns the source as admin and student survey items' do
expect(measure.sources).to eq [:admin_data, :student_surveys]
end
end
context 'when a measure includes admin data and teacher survey items' do
@ -96,6 +115,9 @@ RSpec.describe Measure, type: :model do
# (2*3 + 1.2)/4
expect(measure.watch_low_benchmark).to be 1.8
end
it 'returns the source as admin and teacher survey items' do
expect(measure.sources).to eq [:admin_data, :teacher_surveys]
end
end
context 'when a measure includes student and teacher survey items' do
@ -117,6 +139,9 @@ RSpec.describe Measure, type: :model do
# (1.2+ 1.5)/2
expect(measure.watch_low_benchmark).to be 1.35
end
it 'returns the source as student and teacher survey items' do
expect(measure.sources).to eq [:student_surveys, :teacher_surveys]
end
end
context 'when a measure includes admin data and student and teacher survey items' do
@ -149,5 +174,9 @@ RSpec.describe Measure, type: :model do
# (5 * 3 + 4.2 + 4.5)/ 5
expect(measure.ideal_low_benchmark).to be_within(0.001).of 4.74
end
it 'returns the source as admin student and teacher survey items' do
expect(measure.sources).to eq [:admin_data, :student_surveys, :teacher_surveys]
end
end
end

@ -6,6 +6,8 @@ SimpleCov.start do
add_filter "/spec/models/legacy"
add_filter "/spec/views/legacy"
add_filter "/spec/controllers/legacy"
add_filter "/app/helpers/schedules_helper.rb"
add_filter "/lib/tasks/survey.rake"
end
require 'capybara/rspec'

@ -124,16 +124,6 @@ def go_to_different_district(district)
select district.name, from: 'select-district'
end
def go_to_browse_page_for_school_without_data(school)
click_on 'Browse'
select school.name, from: 'select-school'
end
def go_to_overview_page_for_school_without_data(school)
click_on 'Overview'
select school.name, from: 'select-school'
end
def district_admin_sees_schools_change
expected_path = "/districts/#{school_in_same_district.district.slug}/schools/#{school_in_same_district.slug}/browse/teachers-and-leadership?year=2020-21"
expect(page).to have_current_path(expected_path)

Loading…
Cancel
Save