Skip to content

Commit 7bb06ca

Browse files
Other dummy
1 parent bf8b7ee commit 7bb06ca

2 files changed

Lines changed: 25 additions & 0 deletions

File tree

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# frozen_string_literal: true
2+
3+
module Decidim
4+
# An example implementation of an AuthorizationHandler to be used in tests.
5+
class AnotherDummyAuthorizationHandler < AuthorizationHandler
6+
attribute :passport_number, String
7+
8+
validates :passport_number, presence: true
9+
validate :valid_passport_number
10+
11+
def unique_id
12+
passport_number
13+
end
14+
15+
private
16+
17+
def valid_passport_number
18+
errors.add(:passport_number, :invalid) unless passport_number.start_with?("A")
19+
end
20+
end
21+
end

decidim-verifications/lib/decidim/verifications/dummy.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,7 @@
55
workflow.action_authorizer = "Decidim::DummyAuthorizationHandler::ActionAuthorizer"
66
workflow.expires_in = 1.hour
77
end
8+
9+
Decidim::Verifications.register_workflow(:another_dummy_authorization_handler) do |workflow|
10+
workflow.form = "Decidim::AnotherDummyAuthorizationHandler"
11+
end

0 commit comments

Comments
 (0)