semester_process_volunteers_test.rb 1.53 KB
Newer Older
1 2 3 4 5
require 'application_system_test_case'

class SemesterProcessVolunteersTest < ApplicationSystemTestCase
  setup do
    @current_semester = Semester.new
6 7 8
    @one_semester_back = create :semester_process, :with_volunteers, semester: @current_semester.previous_s
    @two_semesters_back = create :semester_process, :with_volunteers, semester: @current_semester.previous_s(2)
    @three_semesters_back = create :semester_process, :with_volunteers, semester: @current_semester.previous_s(3)
9
    login_as create(:user)
Jiri Strojil's avatar
Jiri Strojil committed
10
    visit semester_process_volunteers_path(semester: Semester.to_s(@one_semester_back.semester))
11 12 13
  end

  test 'filter semester process volunteer shows previous semester by default' do
14 15
    assert page.has_text? @one_semester_back.semester_process_volunteers.first.semester_feedbacks.first.goals
    assert_not page.has_text? @two_semesters_back.semester_process_volunteers.first.semester_feedbacks.first.goals
16 17 18 19 20
  end

  test 'filter semester process volunteer on semester' do
    click_button "Semester: #{@current_semester.previous_s[0..3]},#{@current_semester.previous_s[5]}", match: :first
    click_link "#{@current_semester.previous_s(2)[5]}. Semester #{@current_semester.previous_s(2)[0..3]}"
21 22 23
    assert_not page.has_text? @one_semester_back.semester_process_volunteers.first.semester_feedbacks.first.goals
    assert page.has_text? @two_semesters_back.semester_process_volunteers.first.semester_feedbacks.first.goals
    assert_not page.has_text? @three_semesters_back.semester_process_volunteers.first.semester_feedbacks.first.goals
24 25
  end
end