From 62d3d12149b8b17d03786a372d5cfe59c84a29b5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rafael=20Mendon=C3=A7a=20Fran=C3=A7a?=
 <rafaelmfranca@gmail.com>
Date: Fri, 4 Aug 2017 16:50:21 -0400
Subject: Make sure the test fails if the code chages

The test was passing before because it was not being testes correctly.

Now we create a different engine that is loaded before the already
exising and we make sure that the first call for isolate_namespace is
what takes effect.
---
 railties/test/railties/engine_test.rb | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

(limited to 'railties/test')

diff --git a/railties/test/railties/engine_test.rb b/railties/test/railties/engine_test.rb
index 247c78db27..145c2ec7b6 100644
--- a/railties/test/railties/engine_test.rb
+++ b/railties/test/railties/engine_test.rb
@@ -882,15 +882,17 @@ YAML
         end
       RUBY
 
-      @plugin.write "lib/new_lugin.rb", <<-RUBY
-        module AppTemplate
-          module NewPlugin
-            class Engine < ::Rails::Engine
-              isolate_namespace(AppTemplate)
+      engine "loaded_first" do |plugin|
+        plugin.write "lib/loaded_first.rb", <<-RUBY
+          module AppTemplate
+            module LoadedFirst
+              class Engine < ::Rails::Engine
+                isolate_namespace(AppTemplate)
+              end
             end
           end
-        end
-      RUBY
+        RUBY
+      end
 
       app_file "config/routes.rb", <<-RUBY
         Rails.application.routes.draw do end
@@ -898,7 +900,7 @@ YAML
 
       boot_rails
 
-      assert_equal AppTemplate::Engine, AppTemplate.railtie_namespace
+      assert_equal AppTemplate::LoadedFirst::Engine, AppTemplate.railtie_namespace
     end
 
     test "properly reload routes" do
-- 
cgit v1.2.3