Commit 81a0ecba authored by Jiri Strojil's avatar Jiri Strojil

Tmp

parent 47d5777a
......@@ -81,4 +81,27 @@ class SemesterProcessVolunteerTest < ActiveSupport::TestCase
assert subject.hours.include? hour_assignment
assert subject.hours.include? hour_group_assignment
end
test '#build missions with ending date' do
travel_to time_z(2018, 7, 15)
semester = Semester.new
semester_process = SemesterProcess.new(semester: semester.previous, creator: create(:user))
@assignment.update(period_start: time_z(2015, 7, 15), period_end: time_z(2016, 7, 15))
subject = SemesterProcessVolunteer.new(semester_process: semester_process, volunteer: @volunteer)
subject.build_missions(semester.previous)
assert_equal 0, subject.semester_process_volunteer_missions.size
end
test '#active_missions scope' do
travel_to time_z(2018, 7, 15)
semester = Semester.new
semester_process = SemesterProcess.new(semester: semester.previous, creator: create(:user))
@assignment.update(period_start: time_z(2015, 7, 15))
subject = SemesterProcessVolunteer.new(semester_process: semester_process, volunteer: @volunteer)
subject.build_missions(semester.previous)
@assignment.update(period_end: time_z(2016, 7, 15))
assert_equal 1, subject.semester_process_volunteer_missions.size
assert_equal 0, subject.semester_process_volunteer_missions.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