You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
95 lines
4.4 KiB
95 lines
4.4 KiB
require "rails_helper"
|
|
|
|
describe TeacherSurveyPresenter do
|
|
let(:school) { nil }
|
|
let(:academic_year) { nil }
|
|
let(:measure_1A_i) { create(:measure, measure_id: "1A-i") }
|
|
let(:scale_1) { create(:teacher_scale, measure: measure_1A_i) }
|
|
let(:survey_item_1) do
|
|
create(:teacher_survey_item, survey_item_id: "t-1", scale: scale_1,
|
|
prompt: "Given your preparation for teaching how comfortable are you teaching at the grade-level you have been assigned?")
|
|
end
|
|
let(:survey_item_2) do
|
|
create(:teacher_survey_item, survey_item_id: "t-2", scale: scale_1,
|
|
prompt: "How prepared are you for teaching the topics that you are expected to teach in your assignment?")
|
|
end
|
|
let(:survey_item_3) do
|
|
create(:teacher_survey_item, survey_item_id: "t-3", scale: scale_1,
|
|
prompt: "How confident are you in working with the student body at your school?")
|
|
end
|
|
let(:measure_1B_i) { create(:measure, measure_id: "1B-i") }
|
|
let(:scale_2) { create(:teacher_scale, measure: measure_1B_i) }
|
|
let(:survey_item_4) do
|
|
create(:teacher_survey_item, scale: scale_2,
|
|
prompt: "Some prompt that will not be shown. Instead it will say items will be available upon request to MCIEA")
|
|
end
|
|
before do
|
|
scale_1
|
|
scale_2
|
|
survey_item_1
|
|
survey_item_2
|
|
survey_item_3
|
|
survey_item_4
|
|
end
|
|
|
|
describe "#item_description" do
|
|
context "When the presenter is based on measure 1A-1" do
|
|
it "returns a list of survey prompts for teacher survey items" do
|
|
expect(TeacherSurveyPresenter.new(measure_id: measure_1A_i.measure_id, survey_items: measure_1A_i.teacher_survey_items,
|
|
has_sufficient_data: true, school:, academic_year:).item_descriptions).to eq [
|
|
"Given your preparation for teaching how comfortable are you teaching at the grade-level you have been assigned?",
|
|
"How prepared are you for teaching the topics that you are expected to teach in your assignment?",
|
|
"How confident are you in working with the student body at your school?"
|
|
]
|
|
end
|
|
end
|
|
|
|
context "When the presenter is based on measure 1B-i" do
|
|
it "returns a message hiding the actual prompts. Instead it presents a message telling the user they can ask for more information" do
|
|
expect(TeacherSurveyPresenter.new(measure_id: measure_1B_i.measure_id, survey_items: measure_1B_i.teacher_survey_items,
|
|
has_sufficient_data: true, school:, academic_year:).item_descriptions).to eq [
|
|
"Items available upon request to MCIEA."
|
|
]
|
|
end
|
|
end
|
|
end
|
|
|
|
describe "#descriptions_and_availability" do
|
|
context "When the presenter is NOT based on measure 1B-i" do
|
|
it "returns a list containing the survey item properties" do
|
|
expect(
|
|
TeacherSurveyPresenter.new(
|
|
measure_id: measure_1A_i.measure_id,
|
|
survey_items: measure_1A_i.teacher_survey_items,
|
|
has_sufficient_data: true,
|
|
school:,
|
|
academic_year:
|
|
).descriptions_and_availability
|
|
).to eq [
|
|
Summary.new("t-1",
|
|
"Given your preparation for teaching how comfortable are you teaching at the grade-level you have been assigned?", true),
|
|
Summary.new("t-2",
|
|
"How prepared are you for teaching the topics that you are expected to teach in your assignment?", true),
|
|
Summary.new("t-3",
|
|
"How confident are you in working with the student body at your school?", true)
|
|
]
|
|
end
|
|
end
|
|
context "When the presenter is based on measure 1B-i" do
|
|
it "returns a message hiding the actual prompts. Instead it presents a message telling the user they can ask for more information" do
|
|
expect(
|
|
TeacherSurveyPresenter.new(
|
|
measure_id: measure_1B_i.measure_id,
|
|
survey_items: measure_1B_i.teacher_survey_items,
|
|
has_sufficient_data: true,
|
|
school:,
|
|
academic_year:
|
|
).descriptions_and_availability
|
|
).to eq [
|
|
Summary.new("1B-i", "Items available upon request to MCIEA", true)
|
|
]
|
|
end
|
|
end
|
|
end
|
|
end
|