Sha256: b86a3c0e65be70ac842f65ed99800641542ec1ee7aedaf7086a5d4f766239ae4
Contents?: true
Size: 1.42 KB
Versions: 59
Compression:
Stored size: 1.42 KB
Contents
# frozen_string_literal: true require "decidim/verifications/workflows" module Decidim module Verifications module DummyVerification # Dummy engine to be able to test verifications. class Engine < ::Rails::Engine isolate_namespace Decidim::Verifications::DummyVerification paths["lib/tasks"] = nil routes do root to: proc { [200, {}, ["DUMMY VERIFICATION ENGINE"]] } get :edit_authorization, to: proc { [200, {}, ["CONTINUE YOUR VERIFICATION"]] } get :renew_authorization, to: proc { [200, {}, ["RENEW YOUR VERIFICATION"]] } end end end end end Decidim::Verifications.register_workflow(:dummy_authorization_workflow) do |workflow| workflow.engine = Decidim::Verifications::DummyVerification::Engine workflow.expires_in = 1.hour workflow.renewable = true workflow.time_between_renewals = 5.minutes end RSpec.configure do |config| config.around(:example, :with_authorization_workflows) do |example| previous_workflows = Decidim::Verifications.workflows.dup new_workflows = example.metadata[:with_authorization_workflows].map do |name| Decidim::Verifications.find_workflow_manifest(name) end Decidim::Verifications.reset_workflows(*new_workflows) Rails.application.reload_routes! example.run ensure Decidim::Verifications.reset_workflows(*previous_workflows) Rails.application.reload_routes! end end
Version data entries
59 entries across 59 versions & 1 rubygems