diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2017-07-21 15:50:36 -0500 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2017-07-21 15:50:36 -0500 |
commit | 0c47740d858cb04c7165bce411584c3b05d155b6 (patch) | |
tree | c4b6b809386df6ef5c2ed35bc21153a216bb5c25 | |
parent | 9ac31a3c8a7bf996ef2614a2dc83c1d345c78b35 (diff) | |
download | rails-0c47740d858cb04c7165bce411584c3b05d155b6.tar.gz rails-0c47740d858cb04c7165bce411584c3b05d155b6.tar.bz2 rails-0c47740d858cb04c7165bce411584c3b05d155b6.zip |
Hacky way to mount routes for engine controller tests
-rw-r--r-- | test/test_helper.rb | 11 |
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 |