Commit 7c54416a authored by Zac Wood's avatar Zac Wood
Browse files

Merge branch 'course-refactor' into 'master'

Course refactor

See merge request !40
parents 676b28b8 7a2a9aff
Pipeline #3852 failed with stages
in 18 minutes and 3 seconds
......@@ -12,6 +12,7 @@ cs112001:
location: Innovation Hall 204
course: cs112
instructor: kinga
semester: fall2018
cs112002:
name: CS 112 002
......@@ -25,6 +26,7 @@ cs112002:
end_time: 2:00 pm
course: cs112
instructor: luke
semester: fall2018
cs211001:
name: CS 211 001
......@@ -36,8 +38,9 @@ cs211001:
start_time: 2:30 pm
end_time: 3:00 pm
location: ENGR 200
course: cs211spring
course: cs211
instructor: otten
semester: spring2018
cs112001spring:
name: CS 112 001
......@@ -49,8 +52,9 @@ cs112001spring:
start_time: 12:00 pm
end_time: 1:00 pm
location: Innovation Hall 204
course: cs112spring
course: cs112
instructor: kinga
semester: spring2018
acct110001:
name: ACCT 110 001
......@@ -62,5 +66,6 @@ acct110001:
start_time: 12:00 pm
end_time: 1:00 pm
location: Innovation Hall 204
course: acct110spring
course: acct110
instructor: business_man
semester: spring2018
......@@ -3,24 +3,13 @@
cs112:
subject: CS
course_number: 112
semester: fall2018
cs211:
subject: CS
course_number: 211
semester: fall2018
acct110spring:
acct110:
subject: ACCT
course_number: 110
semester: spring2018
cs110spring:
subject: CS
course_number: 110
semester: spring2018
cs112spring:
subject: CS
course_number: 112
semester: spring2018
......@@ -13,8 +13,9 @@ class CourseSectionTest < ActiveSupport::TestCase
CourseSection.create! name: 'Test section',
crn: '12345',
title: 'Test title',
course_id: courses(:cs211).id,
instructor_id: instructors(:luke).id
course: courses(:cs211),
instructor: instructors(:luke),
semester: semesters(:fall2018)
end
test '#with_instructor filters correctly' do
......@@ -24,6 +25,6 @@ class CourseSectionTest < ActiveSupport::TestCase
test '#latest_by_crn sorts correctly' do
s = CourseSection.latest_by_crn(70192)
assert_equal semesters(:fall2018).id, s.course.semester.id
assert_equal semesters(:fall2018).id, s.semester.id
end
end
......@@ -3,15 +3,15 @@ require 'test_helper'
class CourseTest < ActiveSupport::TestCase
test 'fails with improper data' do
assert_raise do
Course.create! course_number: nil, subject: nil, semester_id: nil
Course.create! course_number: nil, subject: nil
end
end
test 'creates with proper data' do
Course.create! course_number: '112', subject: 'CS', semester_id: semesters(:fall2018).id
Course.create! course_number: '112', subject: 'CS'
end
test 'has correct number of sections' do
assert_equal 2, courses(:cs112).course_sections.count
assert_equal 3, courses(:cs112).course_sections.count
end
end
......@@ -10,8 +10,4 @@ class SemesterTest < ActiveSupport::TestCase
test 'create successful' do
Semester.create!(season: 'Test', year: 'Test')
end
test 'semester has correct number of courses' do
assert_equal 2, semesters(:fall2018).courses.count
end
end
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment