Commit 5f878404 authored by Chrysanthi Lagodimou's avatar Chrysanthi Lagodimou

Dry test for automatic generation of journals

parent faf0f43c
......@@ -12,16 +12,16 @@ class SemesterFeedbackTest < ApplicationSystemTestCase
def submit_feedback(semester_process_volunteer)
visit review_semester_semester_process_volunteer_path(semester_process_volunteer)
fill_in_required_feedback_fields
fill_in_required_feedback_fields(0)
check 'Ich verzichte auf die Auszahlung von Spesen.'
click_on 'Bestätigen', match: :first
semester_process_volunteer.reload
end
def fill_in_required_feedback_fields
fill_in 'Was waren die wichtigsten Inhalte (oder Ziele) Ihres Einsatzes in den letzten Monaten?', with: 'being on time'
fill_in 'Was konnte in den letzten Monaten erreicht werden?', with: 'everything'
fill_in 'Soll der Einsatz weiterlaufen und wenn ja, mit welchen Inhalten (Zielen)?', with: 'continue'
def fill_in_required_feedback_fields(id)
find("#semester_process_volunteer_semester_feedbacks_attributes_#{id}_semester_feedback_goals").set('being on time')
find("#semester_process_volunteer_semester_feedbacks_attributes_#{id}_semester_feedback_achievements").set('everything')
find("#semester_process_volunteer_semester_feedbacks_attributes_#{id}_semester_feedback_future").set('continue')
end
test 'volunteer with unsubmitted feedback should see a warning' do
......@@ -56,7 +56,7 @@ class SemesterFeedbackTest < ApplicationSystemTestCase
end
test 'you should be able to add hours on run' do
fill_in_required_feedback_fields
fill_in_required_feedback_fields(0)
fill_in 'Stunden', with: 10
check 'Ich verzichte auf die Auszahlung von Spesen.'
click_on 'Bestätigen', match: :first
......@@ -67,7 +67,7 @@ class SemesterFeedbackTest < ApplicationSystemTestCase
end
test 'iban and bank has to be filled' do
fill_in_required_feedback_fields
fill_in_required_feedback_fields(0)
uncheck 'Ich verzichte auf die Auszahlung von Spesen.'
fill_in 'IBAN', with: ''
fill_in 'Bank', with: ''
......@@ -80,7 +80,7 @@ class SemesterFeedbackTest < ApplicationSystemTestCase
end
test 'it should store the info that user inputs' do
fill_in_required_feedback_fields
fill_in_required_feedback_fields(0)
fill_in 'Kommentare', with: 'nothing'
check 'Ich wünsche ein Gespräch mit meiner/meinem Freiwilligenverantwortlichen.'
fill_in 'Stunden', with: 33
......@@ -143,19 +143,13 @@ class SemesterFeedbackTest < ApplicationSystemTestCase
visit review_semester_semester_process_volunteer_path(spv)
assert_difference 'Journal.count', 1 do
find('#semester_process_volunteer_semester_feedbacks_attributes_0_semester_feedback_goals').set('being on time')
find('#semester_process_volunteer_semester_feedbacks_attributes_0_semester_feedback_achievements').set('achievements')
find('#semester_process_volunteer_semester_feedbacks_attributes_0_semester_feedback_future').set('future')
find('#semester_process_volunteer_semester_feedbacks_attributes_1_semester_feedback_goals').set('goals')
find('#semester_process_volunteer_semester_feedbacks_attributes_1_semester_feedback_achievements').set('achievements')
find('#semester_process_volunteer_semester_feedbacks_attributes_1_semester_feedback_future').set('future')
fill_in_required_feedback_fields(0)
fill_in_required_feedback_fields(1)
check 'Ich verzichte auf die Auszahlung von Spesen.'
click_on 'Bestätigen', match: :first
spv.reload
end
assert Journal.last.body.include? volunteer.assignments.first.to_label
assert Journal.last.body.include? volunteer.assignments.second.to_label
assert Journal.last.body.include? spv.semester_feedbacks.first.goals
assert Journal.last.body.include? spv.semester_feedbacks.second.goals
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