From 2c5ac890d205303a907ce521743943c0674312a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niklas=20J=C3=A4ggi?= Date: Tue, 31 Dec 2024 13:07:30 +0100 Subject: [PATCH] Add spec --- .../groups/self_registration_controller_spec.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/spec/controllers/groups/self_registration_controller_spec.rb b/spec/controllers/groups/self_registration_controller_spec.rb index 6db11bc18..e86a253b0 100644 --- a/spec/controllers/groups/self_registration_controller_spec.rb +++ b/spec/controllers/groups/self_registration_controller_spec.rb @@ -120,5 +120,17 @@ def wizard_params(step: 0, **attrs) expect(flash[:notice]).to eq "Du ist einer Familie zugeordnet. Kontaktiere bitte die SAC-Geschäftsstelle." end end + + context "without primary group id" do + let(:person) { Fabricate(:person) } + + it "redirects to memberships tab layered under root group with a flash message" do + allow_any_instance_of(Wizards::Signup::SektionWizard).to receive(:member_or_applied?).and_return(true) + get :show, params: wizard_params + + expect(response).to redirect_to(history_group_person_path(group_id: Group.root.id, id: person.id)) + expect(flash[:notice]).to eq "Du besitzt bereits eine SAC-Mitgliedschaft. Wenn du diese anpassen möchtest, kontaktiere bitte die SAC-Geschäftsstelle." + end + end end end