From 12b6dbe34da9ca8c5f810e75cca144a4e9dabed9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niklas=20J=C3=A4ggi?= Date: Wed, 18 Dec 2024 17:31:01 +0100 Subject: [PATCH] Fix feature specs --- spec/features/signup/abo_basic_login_spec.rb | 11 ++--------- spec/features/signup/abo_magazin_spec.rb | 7 +++++++ spec/features/signup/abo_touren_portal_spec.rb | 7 +++++++ 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/spec/features/signup/abo_basic_login_spec.rb b/spec/features/signup/abo_basic_login_spec.rb index c9516e0c7..cb32335f0 100644 --- a/spec/features/signup/abo_basic_login_spec.rb +++ b/spec/features/signup/abo_basic_login_spec.rb @@ -103,16 +103,9 @@ def expect_validation_error(message) end end - it "has prefilled form when logged in" do - people(:admin).update!(country: "CH") + it "redirects if logged in" do sign_in(people(:admin)) visit group_self_registration_path(group_id: group) - expect(page).to have_text "SAC-KONTO ERSTELLEN" - expect(page).not_to have_text "Weiter" - check "Ich habe die Datenschutzerklärung gelesen und stimme dieser zu" - expect do - click_button "SAC-KONTO ERSTELLEN" - expect(page).to have_css "#error_explanation, #flash > .alert" - end.to change { Role.count }.by(1) + expect(page).to have_content("Du besitzt bereits eine SAC-Mitgliedschaft. Wenn du diese anpassen möchtest, kontaktiere bitte die SAC-Geschäftsstelle.") end end diff --git a/spec/features/signup/abo_magazin_spec.rb b/spec/features/signup/abo_magazin_spec.rb index e9ed13ef3..f72f3abba 100644 --- a/spec/features/signup/abo_magazin_spec.rb +++ b/spec/features/signup/abo_magazin_spec.rb @@ -170,4 +170,11 @@ def complete_last_page(date: Date.tomorrow, submit: true) expect(page).to have_css "#error_explanation, #flash > .alert" end.to change { Role.count }.by(1) end + + it "redirects if already abonnent of magazin" do + sign_in(people(:mitglied)) + Group::AboMagazin::Abonnent.create!(person: people(:mitglied), group: group) + visit group_self_registration_path(group_id: group) + expect(page).to have_content("Du besitzt bereits eine SAC-Mitgliedschaft. Wenn du diese anpassen möchtest, kontaktiere bitte die SAC-Geschäftsstelle.") + end end diff --git a/spec/features/signup/abo_touren_portal_spec.rb b/spec/features/signup/abo_touren_portal_spec.rb index ae8bf8f61..1f7e3fda8 100644 --- a/spec/features/signup/abo_touren_portal_spec.rb +++ b/spec/features/signup/abo_touren_portal_spec.rb @@ -128,4 +128,11 @@ def expect_validation_error(message) expect(page).to have_css "#error_explanation, #flash > .alert" end.to change { Role.count }.by(1) end + + it "redirects if already abonnent of touren portal" do + sign_in(people(:mitglied)) + Group::AboTourenPortal::Abonnent.create!(person: people(:mitglied), group: group) + visit group_self_registration_path(group_id: group) + expect(page).to have_content("Du besitzt bereits eine SAC-Mitgliedschaft. Wenn du diese anpassen möchtest, kontaktiere bitte die SAC-Geschäftsstelle.") + end end