Hacky way to mount routes for engine controller tests

上级 9ac31a3c
......@@ -34,6 +34,17 @@ def create_blob(data: "Hello world!", filename: "hello.txt", content_type: "text
end
end
require "action_controller"
require "action_controller/test_case"
class ActionController::TestCase
Routes = ActionDispatch::Routing::RouteSet.new.tap do |routes|
routes.draw do
# FIXME: Hacky way to avoid having to instantiate the real engine
eval(File.readlines(File.expand_path("../../config/routes.rb", __FILE__)).slice(1..-2).join("\n"))
end
end
end
require "active_storage/attached"
ActiveRecord::Base.send :extend, ActiveStorage::Attached::Macros
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册