fix: spec and fix of user invitation not accepted getting password set

parent b7b64cb6
Pipeline #77087 failed with stage
in 22 minutes and 5 seconds
......@@ -72,8 +72,11 @@ class UsersController < ApplicationController
if user_params[:password].blank?
@user.update_without_password(user_params)
else
@user.accept_invitation! if @user.invited_to_sign_up? && !@user.invitation_accepted?
@user.update(user_params)
@user.assign_attributes(user_params)
if @user.invited_to_sign_up? && !@user.invitation_accepted?
@user.accept_invitation!
end
@user.save
end
end
......
......@@ -33,12 +33,16 @@ class AdminResetUserPasswordTest < ApplicationSystemTestCase
test 'Admin sets password for invited volunteer and then volunteer can login without accepting invitation' do
volunteer = create :volunteer_internal, acceptance: :undecided
volunteer.contact.update!(primary_email: 'volunteer@aoz.ch')
volunteer.accepted!
form_login_user(@admin, @comon_pw)
update_users_password(volunteer.user, @common_changed_pw, email: 'volunteer@aoz.ch')
login_as(@admin)
visit edit_volunteer_path(volunteer)
select 'Akzeptiert', from: 'Prozess'
click_button 'Freiwillige/n aktualisieren', match: :first
assert_text "Einladung wurde an #{volunteer.contact.primary_email} verschickt"
volunteer.reload
assert_text volunteer.contact.full_name
update_users_password(volunteer.user, @common_changed_pw, email: volunteer.contact.primary_email)
sign_out_logged_in_user(@admin)
form_login_user(volunteer.user, @common_changed_pw, email: 'volunteer@aoz.ch')
form_login_user(volunteer.user, @common_changed_pw, email: volunteer.contact.primary_email)
end
test 'logged in before volunteer can log in with password admin sets' do
......
......@@ -241,7 +241,7 @@ class ClientsTest < ApplicationSystemTestCase
test 'new_client_form_has_german_with_its_non_native_speaker_abilities' do
login_as @superadmin
visit new_client_path
assert_text 'Sprachkenntnisse Deutsch * Niveau'
assert_text 'Sprachkenntnisse Deutsch * Niveau', normalize_ws: true
within '#languages' do
choose('Wenig')
end
......
......@@ -97,7 +97,7 @@ class EventsTest < ApplicationSystemTestCase
@event.update(event_volunteers: [@event_volunteer], date: 7.days.from_now)
visit volunteer_path(@event_volunteer.volunteer)
assert_text @event_volunteer.contact.full_name
assert_text @event_volunteer.volunteer.contact.full_name
assert_not page.has_css?('#volunteer-events'), wait: 0
end
......@@ -105,9 +105,9 @@ class EventsTest < ApplicationSystemTestCase
@event_volunteer = create :event_volunteer
@event.update(event_volunteers: [@event_volunteer])
login_as @event_volunteer
login_as @event_volunteer.volunteer.user
visit volunteer_path(@event_volunteer.volunteer)
assert_text @event_volunteer.contact.full_name
assert_text @event_volunteer.volunteer.contact.full_name
assert_not page.has_css?('#volunteer-events'), wait: 0
end
......
......@@ -156,19 +156,21 @@ class SemesterFeedbackTest < ApplicationSystemTestCase
wait_for_ajax
visit semester_process_volunteers_path(semester: Semester.to_s(@spv.semester))
page.find('td', text: goals.truncate(300)).click
page.find('td', text: goals.truncate(300), visible: false).click
wait_for_ajax
assert_text goals
click_button 'Schliessen'
wait_for_ajax
page.find('td', text: achievements.truncate(300)).click
page.find('td', text: achievements.truncate(300), visible: false).click
wait_for_ajax
assert_text achievements
click_button 'Schliessen'
wait_for_ajax
page.find('td', text: comments.truncate(300)).click
assert_text 'Semester Prozess'
page.find('td', text: comments.truncate(300), visible: false).click
wait_for_ajax
assert_text 'Semester Prozess'
assert_text comments
click_button 'Schliessen'
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