Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace turbolinks with turbo #49

Merged
merged 1 commit into from
Feb 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion spec/controllers/event/participations_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@
event_id: course.id,
id: participation.id }

expect(response).to have_http_status(302)
expect(response).to have_http_status(303)
expect(response).to redirect_to(group_event_path(group, course))
end
end
Expand Down
18 changes: 13 additions & 5 deletions spec/features/event_register_managed_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,21 +79,22 @@
expect(page).to have_css('ul.dropdown-menu li a', text: managed.full_name, exact_text: true)
find('ul.dropdown-menu li a', text: managed.full_name, exact_text: true).click

expect(page).to have_content 'Kontaktangaben der teilnehmenden Person'
contact_data_path = contact_data_group_event_participations_path(group, event)
expect(current_path).to eq(contact_data_path)

expect(page).to have_field('Vorname', with: managed.first_name)
expect(page).to have_field('Nachname', with: managed.last_name)

find_all('button.btn[type="submit"]').last.click

expect(page).to have_content 'Anmeldung als Teilnehmer/-in'
expect(current_path).to eq(new_group_event_participation_path(group, event))

expect do
find_all('button.btn[type="submit"]').last.click
expect(page).to have_content(participation_success_text_for_event(event, managed))
end.to change { Event::Participation.count }.by(1)

expect(page).to have_content(participation_success_text_for_event(event, managed))
end

end
Expand Down Expand Up @@ -138,21 +139,22 @@
expect(page).to have_css('.alert-warning', text: /#{managed.full_name} wurde zu diesem Anlass eingeladen/i)
find('.alert-warning a.btn', text: /Anmelden/i).click

expect(page).to have_content 'Kontaktangaben der teilnehmenden Person'
contact_data_path = contact_data_group_event_participations_path(group, event)
expect(current_path).to eq(contact_data_path)

expect(page).to have_field('Vorname', with: managed.first_name)
expect(page).to have_field('Nachname', with: managed.last_name)

find_all('button.btn[type="submit"]').last.click

expect(page).to have_content 'Anmeldung als Teilnehmer/-in'
expect(current_path).to eq(new_group_event_participation_path(group, event))

expect do
find_all('button.btn[type="submit"]').last.click
expect(page).to have_content(participation_success_text_for_event(event, managed))
end.to change { Event::Participation.count }.by(1)

expect(page).to have_content(participation_success_text_for_event(event, managed))
end
end
end
Expand Down Expand Up @@ -235,6 +237,7 @@
expect(page).to have_css('ul.dropdown-menu li a', text: /Neues Kind erfassen und anmelden/i, exact_text: true)
find('ul.dropdown-menu li a', text: /Neues Kind erfassen und anmelden/i, exact_text: true).click

expect(page).to have_content 'Neues Kind registrieren und am Anlass anmelden'
contact_data_path = contact_data_managed_group_event_participations_path(group, event)
expect(current_path).to eq(contact_data_path)

Expand All @@ -243,6 +246,7 @@

expect do
find_all('button.btn[type="submit"]').last.click
expect(page).to have_content 'Anmeldung als Teilnehmer/-in'
end.to change { Person.count }.by(1)

new_managed = Person.last
Expand All @@ -252,6 +256,8 @@

expect do
find('a.cancel').click
# back on event#show
expect(page).to have_content 'Durchgeführt von'
end.to_not change { Event::Participation.count }

new_managed.reload
Expand All @@ -269,6 +275,7 @@
expect(page).to have_css('ul.dropdown-menu li a', text: /Neues Kind erfassen und anmelden/i, exact_text: true)
find('ul.dropdown-menu li a', text: /Neues Kind erfassen und anmelden/i, exact_text: true).click

expect(page).to have_content 'Neues Kind registrieren und am Anlass anmelden'
contact_data_path = contact_data_managed_group_event_participations_path(group, event)
expect(current_path).to eq(contact_data_path)

Expand All @@ -277,6 +284,7 @@

expect do
find_all('button.btn[type="submit"]').last.click
expect(page).to have_content 'Anmeldung als Teilnehmer/-in'
end.to change { Person.count }.by(1)

new_managed = Person.last
Expand All @@ -286,9 +294,9 @@

expect do
find_all('button.btn[type="submit"]').last.click
expect(page).to have_content(participation_success_text_for_event(event, new_managed))
end.to change { Event::Participation.count }.by(1)

expect(page).to have_content(participation_success_text_for_event(event, new_managed))
end
end
end
Expand Down
14 changes: 7 additions & 7 deletions spec/features/external_event_register_manager_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,22 +88,22 @@
fill_in 'Nachname erziehungsberechtigte Person', with: 'Muster'
fill_in 'Haupt-E-Mail', with: 'max.papi@hitobito.example.com'

expect do
find_all('.offset-md-3.offset-xl-2 .btn-group button[type="submit"]').first.click # submit
end.to change { Person.count }.by(1)
expect do
find_all('.offset-md-3.offset-xl-2 .btn-group button[type="submit"]').first.click # submit
expect(page).to have_text('Deine persönlichen Daten wurden aufgenommen. Du kannst nun deine Kinder via "Anmelden" Knopf anmelden')
end.to change { Person.count }.by(1)

expect(current_path).to eq(group_event_path(group, event))

manager = Person.find_by(email: 'max.papi@hitobito.example.com')
expect(manager).to be_present

expect(page).to have_text('Deine persönlichen Daten wurden aufgenommen. Du kannst nun deine Kinder via "Anmelden" Knopf anmelden')

expect(page).to have_css('a.dropdown-toggle', text: /Anmelden/i, exact_text: true)
find('a.dropdown-toggle', text: /Anmelden/i, exact_text: true).click
expect(page).to have_css('ul.dropdown-menu li a', text: /Neues Kind erfassen und anmelden/i, exact_text: true)
find('ul.dropdown-menu li a', text: 'Neues Kind erfassen und anmelden', exact_text: true).click

expect(page).to have_content 'Neues Kind registrieren und am Anlass anmelden'
contact_data_path = contact_data_managed_group_event_participations_path(group, event)
expect(current_path).to eq(contact_data_path)

Expand All @@ -112,6 +112,7 @@

expect do
find_all('button.btn[type="submit"]').last.click
expect(page).to have_content 'Anmeldung als Teilnehmer/-in'
end.to change { Person.count }.by(1)

new_managed = Person.last
Expand All @@ -121,11 +122,10 @@

expect do
find_all('button.btn[type="submit"]').last.click
expect(page).to have_text(participation_success_text_for_event(event, new_managed))
end.to change { Event::Participation.count }.by(1)

expect(current_path).to eq(group_event_path(group, event))

expect(page).to have_text(participation_success_text_for_event(event, new_managed))
end
end
end
Expand Down
24 changes: 13 additions & 11 deletions spec/features/people_manager_relation_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,15 @@

expect do
all('form button[type="submit"]').last.click
expect(page).to have_content 'Verwalter*in Bottom Member hinzugefügt.'
end.to change { PeopleManager.count }.by(1)
.and change { PaperTrail::Version.count }.by(2)

expect(page).to have_content 'Verwalter*in Bottom Member hinzugefügt.'
expect(page).to have_css('dd a', text: 'Bottom Member')
find('dd a', text: 'Bottom Member').click

expect(current_path).to eq(person_path(id: bottom_member.id))

expect(page).to have_content 'Top Leader'
expect(page).to have_content 'bottom_member@example.com'
expect(current_path).to eq(group_person_path(group_id: bottom_member.primary_group_id, id: bottom_member.id))
end

it 'establishes managed relation' do
Expand All @@ -79,15 +79,15 @@

expect do
all('form button[type="submit"]').last.click
expect(page).to have_content 'Kind Bottom Member hinzugefügt.'
end.to change { PeopleManager.count }.by(1)
.and change { PaperTrail::Version.count }.by(2)

expect(page).to have_content 'Kind Bottom Member hinzugefügt.'
expect(page).to have_css('dd a', text: 'Bottom Member')
find('dd a', text: 'Bottom Member').click

expect(current_path).to eq(person_path(id: bottom_member.id))

expect(page).to have_content 'Top Leader'
expect(page).to have_content 'bottom_member@example.com'
expect(current_path).to eq(group_person_path(group_id: bottom_member.primary_group_id, id: bottom_member.id))
end

it 'can not establish both managed and manager relation' do
Expand Down Expand Up @@ -169,7 +169,7 @@
end

it 'finds person without roles for manager option' do
person_without_roles = Fabricate(:person, first_name: 'Bob', last_name: 'Foo')
person_without_roles = Fabricate(:person, first_name: 'Bob', last_name: 'Foo', email: 'bob@example.com')

visit edit_group_person_path(group_id: bottom_member.primary_group_id, id: bottom_member)

Expand All @@ -187,13 +187,15 @@

expect do
all('form button[type="submit"]').last.click
expect(page).to have_content "Verwalter*in #{person_without_roles.person_name} hinzugefügt."
end.to change { PeopleManager.count }.by(1)
.and change { PaperTrail::Version.count }.by(2)

expect(page).to have_content "Verwalter*in #{person_without_roles.person_name} hinzugefügt."
expect(page).to have_css('dd a', text: 'Bob Foo')
find('dd a', text: 'Bob Foo').click

expect(current_path).to eq(person_path(id: person_without_roles))
expect(page).to have_content "bob@example.com"
expect(current_path).to eq(group_person_path(group_id: Group.root.id, id: person_without_roles.id))
end

it 'can not add same manager twice' do
Expand Down