Verified Commit b4378ac3 authored by Kaspar Vollenweider's avatar Kaspar Vollenweider 👻
Browse files

add specs for controller prefill

parent 43baa117
require 'test_helper'
class JournalsControllerTest < ActionDispatch::IntegrationTest
setup do
@superadmin = create :user
@reminder_mailing = create :reminder_mailing, :half_year
@assignment = @reminder_mailing.reminder_mailing_volunteers.first.reminder_mailable
@volunteer = @assignment.volunteer
@feedback = create :feedback, feedbackable: @assignment, volunteer: @volunteer, author: @volunteer.user
end
test '#new prefilles with feedback quote if feedback_id param is passed' do
login_as @superadmin
get new_volunteer_journal_path(@volunteer, feedback_id: @feedback.id)
@journal = @controller.instance_variable_get(:@journal)
assert_equal @journal.category, 'feedback'
assert_equal @journal.title, "Feedback vom #{I18n.l(@feedback.created_at.to_date)}: "
assert @journal.body.include? @feedback.goals
assert @journal.body.include? @feedback.achievements
assert @journal.body.include? @feedback.future
assert @journal.body.include? @feedback.comments
end
end
......@@ -116,6 +116,15 @@ class ListResponseFeedbacksTest < ApplicationSystemTestCase
assert_equal @superadmin, @group_assignment_fb_pendent.reviewer
end
test 'new_feedback_journal_entry_button_has_feedback_prefilled' do
visit list_responses_feedbacks_path
within 'tbody' do
click_link href: new_volunteer_journal_path(@assignment_fb_pendent.volunteer, feedback_id: @assignment_fb_pendent.id)
end
assert page.has_select? 'Kategorie', with_selected: 'Rückmeldung'
assert page.has_field? 'Titel', with: "Feedback vom #{I18n.l(@assignment_fb_pendent.created_at.to_date)}: "
end
test 'take_feedback_responsibility_works' do
visit list_responses_feedbacks_path
within 'tbody' do
......
Supports Markdown
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