diff --git a/actionpack/test/dispatch/prefix_generation_test.rb b/actionpack/test/dispatch/prefix_generation_test.rb
index <HASH>..<HASH> 100644
--- a/actionpack/test/dispatch/prefix_generation_test.rb
+++ b/actionpack/test/dispatch/prefix_generation_test.rb
@@ -165,16 +165,12 @@ module TestGenerationPrefix
       RailsApplication
     end
 
-    def engine_object
-      @engine_object ||= EngineObject.new
-    end
-
-    def app_object
-      @app_object ||= AppObject.new
-    end
+    attr_reader :engine_object, :app_object
 
     def setup
       RailsApplication.routes.default_url_options = {}
+      @engine_object = EngineObject.new
+      @app_object = AppObject.new
     end
 
     include BlogEngine.routes.mounted_helpers
just assign the instance variables on the test