Blob Blame History Raw
From f52daf556103039082bbd8862e7c39dacf9c74ec Mon Sep 17 00:00:00 2001
From: schneems <richard.schneeman@gmail.com>
Date: Mon, 13 Mar 2017 17:04:08 -0500
Subject: [PATCH] Fix tests

Tests were broken when the default paths that rails loads started to include an asset in action_view. Instead of testing for such brittle conditions, we can look for the elements we want instead.
---
 test/test_railtie.rb | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/test/test_railtie.rb b/test/test_railtie.rb
index 0cdc4b7..68235a9 100644
--- a/test/test_railtie.rb
+++ b/test/test_railtie.rb
@@ -80,7 +80,8 @@ def test_defaults_to_compile_assets_with_env_and_manifest_available
     assert_equal ROOT, env.root
     assert_equal "", env.version
     assert env.cache
-    assert_equal ["#{ROOT}/app/assets/config"], env.paths
+    assert_includes(env.paths, "#{ROOT}/app/assets/config")
+
     assert_nil env.js_compressor
     assert_nil env.css_compressor
   end
@@ -128,8 +129,9 @@ def test_copies_paths
     app.initialize!
 
     assert env = app.assets
-    assert_equal ["#{ROOT}/app/assets/config", "#{ROOT}/javascripts", "#{ROOT}/stylesheets"],
-      env.paths.sort
+    assert_includes(env.paths, "#{ROOT}/javascripts")
+    assert_includes(env.paths, "#{ROOT}/stylesheets")
+    assert_includes(env.paths, "#{ROOT}/app/assets/config")
   end
 
   def test_compressors
@@ -220,8 +222,10 @@ def test_configure
     app.initialize!
 
     assert env = app.assets
-    assert_equal ["#{ROOT}/app/assets/config", "#{ROOT}/javascripts", "#{ROOT}/stylesheets"],
-      env.paths.sort
+
+    assert_includes(env.paths, "#{ROOT}/javascripts")
+    assert_includes(env.paths, "#{ROOT}/stylesheets")
+    assert_includes(env.paths, "#{ROOT}/app/assets/config")
   end
 
   def test_environment_is_frozen_if_caching_classes
@@ -381,8 +385,9 @@ def test_direct_build_environment_call
     assert_kind_of Sprockets::Environment, env
 
     assert_equal ROOT, env.root
-    assert_equal ["#{ROOT}/app/assets/config", "#{ROOT}/javascripts", "#{ROOT}/stylesheets"],
-      env.paths.sort
+    assert_includes(env.paths, "#{ROOT}/javascripts")
+    assert_includes(env.paths, "#{ROOT}/stylesheets")
+    assert_includes(env.paths, "#{ROOT}/app/assets/config")
   end
 
   def test_quiet_assets_defaults_to_off