Commit a65237e7 authored by Jiri Strojil's avatar Jiri Strojil

Tests to cover the SPV index page

parent 7ce4ff16
Pipeline #33034 failed with stage
in 43 minutes and 31 seconds
......@@ -55,6 +55,16 @@ class SemesterProcessVolunteerTest < ActiveSupport::TestCase
subject = SemesterProcessVolunteer.new(semester_process: semester_process, volunteer: @volunteer)
subject.build_missions(semester.previous)
assert_equal 1, subject.semester_process_volunteer_missions.size
@group_assignment.update(period_start: semester_process.semester.end.advance(days: -2))
subject = SemesterProcessVolunteer.new(semester_process: semester_process, volunteer: @volunteer)
subject.build_missions(semester.previous)
assert_equal 1, subject.semester_process_volunteer_missions.size
@group_assignment.update(period_start: semester_process.semester.end.advance(weeks: -4))
subject = SemesterProcessVolunteer.new(semester_process: semester_process, volunteer: @volunteer)
subject.build_missions(semester.previous)
assert_equal 2, subject.semester_process_volunteer_missions.size
end
test '#build_mails' do
......@@ -99,11 +109,18 @@ class SemesterProcessVolunteerTest < ActiveSupport::TestCase
semester_process = SemesterProcess.new(semester: semester.previous, creator: create(:user))
@assignment.update(period_start: time_z(2015, 7, 15))
@group_assignment.update(period_start: time_z(2015, 7, 15))
subject = SemesterProcessVolunteer.new(semester_process: semester_process, volunteer: @volunteer)
subject.build_missions(semester.previous)
subject.save
subject.reload
@assignment.update(period_end: time_z(2016, 7, 15))
assert_equal 1, subject.semester_process_volunteer_missions.size
assert_equal 2, subject.semester_process_volunteer_missions.size
assert_equal 1, subject.semester_process_volunteer_missions.need_feedback.size
assert_equal 1, semester_process.semester_process_volunteers.active_missions.size
@group_assignment.update(period_end: time_z(2018, 7, 15))
assert_equal 2, subject.semester_process_volunteer_missions.size
assert_equal 0, subject.semester_process_volunteer_missions.need_feedback.size
assert_equal 0, SemesterProcessVolunteer.index(Semester.new).size
assert_equal 0, semester_process.semester_process_volunteers.active_missions.size
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