-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adapt spec for changed self registration buttons (#2772)
- Loading branch information
1 parent
c0a3db9
commit 5ee0dd5
Showing
1 changed file
with
15 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,8 +5,7 @@ | |
# or later. See the COPYING file at the top-level directory or at | ||
# https://github.com/hitobito/hitobito_jemk. | ||
|
||
|
||
require 'spec_helper' | ||
require "spec_helper" | ||
|
||
describe :self_registration do | ||
subject { page } | ||
|
@@ -22,7 +21,7 @@ class ReadOnly < ::Role | |
end | ||
|
||
let(:group) do | ||
Group::SelfRegistrationGroup.create!(name: 'Self-Registration Group') | ||
Group::SelfRegistrationGroup.create!(name: "Self-Registration Group") | ||
end | ||
|
||
let(:self_registration_role) { group.decorate.allowed_roles_for_self_registration.first } | ||
|
@@ -34,35 +33,34 @@ class ReadOnly < ::Role | |
allow(Settings.groups.self_registration).to receive(:enabled).and_return(true) | ||
end | ||
|
||
it 'self registers and creates new person' do | ||
it "self registers and creates new person" do | ||
visit group_self_registration_path(group_id: group) | ||
|
||
fill_in 'Vorname', with: 'Max' | ||
fill_in 'Nachname', with: 'Muster' | ||
fill_in 'Haupt-E-Mail', with: '[email protected]' | ||
fill_in "Vorname", with: "Max" | ||
fill_in "Nachname", with: "Muster" | ||
fill_in "Haupt-E-Mail", with: "[email protected]" | ||
|
||
expect do | ||
find_all('.btn-toolbar.bottom button[type="submit"]').first.click # submit | ||
click_on "Registrieren" | ||
expect(page).to have_text( | ||
'Du hast Dich erfolgreich registriert. Du erhältst in Kürze eine E-Mail mit der Anleitung, '\ | ||
'wie Du Deinen Account freischalten kannst.' | ||
"Du hast Dich erfolgreich registriert. Du erhältst in Kürze eine E-Mail mit der Anleitung, " \ | ||
"wie Du Deinen Account freischalten kannst." | ||
) | ||
|
||
end.to change { Person.count }.by(1) | ||
.and change { ActionMailer::Base.deliveries.count }.by(1) | ||
.and change { ActionMailer::Base.deliveries.count }.by(1) | ||
|
||
person = Person.find_by(email: '[email protected]') | ||
person = Person.find_by(email: "[email protected]") | ||
expect(person).to be_present | ||
|
||
person.confirm # confirm email | ||
|
||
person.password = person.password_confirmation = 'really_b4dPassw0rD' | ||
person.password = person.password_confirmation = "really_b4dPassw0rD" | ||
person.save! | ||
|
||
fill_in 'Haupt-E-Mail', with: '[email protected]' | ||
fill_in 'Passwort', with: 'really_b4dPassw0rD' | ||
fill_in "Haupt-E-Mail", with: "[email protected]" | ||
fill_in "Passwort", with: "really_b4dPassw0rD" | ||
|
||
click_button 'Anmelden' | ||
click_button "Anmelden" | ||
|
||
expect(person.roles.map(&:type)).to eq([self_registration_role.to_s]) | ||
expect(current_path).to match(/#{group_person_path(group_id: group, id: person)}.html\z/) | ||
|