Skip to content

Commit

Permalink
Fix feature specs
Browse files Browse the repository at this point in the history
  • Loading branch information
njaeggi authored and amaierhofer committed Dec 18, 2024
1 parent 5cb3676 commit 12b6dbe
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 9 deletions.
11 changes: 2 additions & 9 deletions spec/features/signup/abo_basic_login_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
7 changes: 7 additions & 0 deletions spec/features/signup/abo_magazin_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
7 changes: 7 additions & 0 deletions spec/features/signup/abo_touren_portal_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 12b6dbe

Please sign in to comment.