aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_helper.rb
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2017-07-21 15:50:36 -0500
committerDavid Heinemeier Hansson <david@loudthinking.com>2017-07-21 15:50:36 -0500
commit0c47740d858cb04c7165bce411584c3b05d155b6 (patch)
treec4b6b809386df6ef5c2ed35bc21153a216bb5c25 /test/test_helper.rb
parent9ac31a3c8a7bf996ef2614a2dc83c1d345c78b35 (diff)
downloadrails-0c47740d858cb04c7165bce411584c3b05d155b6.tar.gz
rails-0c47740d858cb04c7165bce411584c3b05d155b6.tar.bz2
rails-0c47740d858cb04c7165bce411584c3b05d155b6.zip
Hacky way to mount routes for engine controller tests
Diffstat (limited to 'test/test_helper.rb')
-rw-r--r--test/test_helper.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/test_helper.rb b/test/test_helper.rb
index 6081fc1bcf..af379ad35a 100644
--- a/test/test_helper.rb
+++ b/test/test_helper.rb
@@ -34,6 +34,17 @@ class ActiveSupport::TestCase
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