-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add adult consent to both self reg forms, refs hitobito/hitobito#2404
- Loading branch information
1 parent
9f46537
commit cb4c547
Showing
6 changed files
with
122 additions
and
2 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
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
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
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
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 |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# frozen_string_literal: true | ||
|
||
# Copyright (c) 2024, Schweizer Alpen-Club. This file is part of | ||
# hitobito_sac_cas and licensed under the Affero General Public License version 3 | ||
# or later. See the COPYING file at the top-level directory or at | ||
# https://github.com/hitobito/hitobito_sac_cas. | ||
|
||
require 'spec_helper' | ||
|
||
describe SelfRegistration::MainPerson do | ||
subject(:model) { described_class.new } | ||
let(:group) { groups(:geschaeftsstelle) } | ||
let(:required_attrs) { { first_name: 'test', last_name: 'dummy' } } | ||
|
||
context 'with group requiring adult consent' do | ||
before do | ||
group.update!( | ||
self_registration_require_adult_consent: true, | ||
self_registration_role_type: group.role_types.first | ||
) | ||
model.primary_group = group | ||
model.attributes = required_attrs | ||
end | ||
|
||
it 'is valid when adult consent is not explicitly denied' do | ||
expect(model).to be_valid | ||
end | ||
|
||
it 'is valid when adult consent is explicitly set' do | ||
model.adult_consent = '1' | ||
expect(model).to be_valid | ||
end | ||
|
||
it 'is invalid when adult consent is explicitly denied' do | ||
model.adult_consent = '0' | ||
expect(model).not_to be_valid | ||
expect(model).to have(1).error_on(:adult_consent) | ||
end | ||
end | ||
end |
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