Sha256: a7ed04d2500572eaee72043bde26577e9f3abb528b0df724864fc9eb7d4fd644
Contents?: true
Size: 905 Bytes
Versions: 16
Compression:
Stored size: 905 Bytes
Contents
# frozen_string_literal: true module Decidim # This is a quick hack so all controller specs have their engine's routes # included as well as our Devise mapping. module ControllerRequests extend ActiveSupport::Concern included do begin engine = (ENV["ENGINE_NAME"].to_s.split("-").map(&:capitalize).join("::") + "::Engine").constantize load_routes engine if engine.respond_to?(:routes) rescue NameError => _exception puts "Failed to automatically inject routes for engine #{ENV["ENGINE_NAME"]}" end end class_methods do def load_routes(klass) routes do klass.routes end end end end end RSpec.configure do |config| config.include Decidim::ControllerRequests, type: :controller config.before :each, type: :controller do @request.env["devise.mapping"] = Devise.mappings[:user] end end
Version data entries
16 entries across 16 versions & 2 rubygems