-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathteacher_spec.rb
More file actions
33 lines (29 loc) · 1012 Bytes
/
Copy pathteacher_spec.rb
File metadata and controls
33 lines (29 loc) · 1012 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
require_relative "../lib/teacher"
require "rspec"
describe Teacher do
it "should store assignments" do
student = double
assignment = double
subject.submit_assignment(student, assignment)
subject.assignment_for_student(student).should eq(assignment)
end
describe "should record a grade" do
it "should record the grade" do
student = double
assignment = double
assignment.should_receive(:grade=).with(95)
subject.submit_assignment(student, assignment)
subject.record_grade(student, 95)
end
end
describe "should provide an average grade for the class" do
it "should provide an average grade" do
assignment_doubles = {
student1: double("Assignment", grade: 95),
student2: double("Assignment", grade: 50),
student3: double("Assignment", grade: 80)
}
subject.average_grade(assignment_doubles).should eq(75)
end
end
end