e49e8ab
From f52daf556103039082bbd8862e7c39dacf9c74ec Mon Sep 17 00:00:00 2001
e49e8ab
From: schneems <richard.schneeman@gmail.com>
e49e8ab
Date: Mon, 13 Mar 2017 17:04:08 -0500
e49e8ab
Subject: [PATCH] Fix tests
e49e8ab
e49e8ab
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.
e49e8ab
---
e49e8ab
 test/test_railtie.rb | 19 ++++++++++++-------
e49e8ab
 1 file changed, 12 insertions(+), 7 deletions(-)
e49e8ab
e49e8ab
diff --git a/test/test_railtie.rb b/test/test_railtie.rb
e49e8ab
index 0cdc4b7..68235a9 100644
e49e8ab
--- a/test/test_railtie.rb
e49e8ab
+++ b/test/test_railtie.rb
e49e8ab
@@ -80,7 +80,8 @@ def test_defaults_to_compile_assets_with_env_and_manifest_available
e49e8ab
     assert_equal ROOT, env.root
e49e8ab
     assert_equal "", env.version
e49e8ab
     assert env.cache
e49e8ab
-    assert_equal ["#{ROOT}/app/assets/config"], env.paths
e49e8ab
+    assert_includes(env.paths, "#{ROOT}/app/assets/config")
e49e8ab
+
e49e8ab
     assert_nil env.js_compressor
e49e8ab
     assert_nil env.css_compressor
e49e8ab
   end
e49e8ab
@@ -128,8 +129,9 @@ def test_copies_paths
e49e8ab
     app.initialize!
e49e8ab
 
e49e8ab
     assert env = app.assets
e49e8ab
-    assert_equal ["#{ROOT}/app/assets/config", "#{ROOT}/javascripts", "#{ROOT}/stylesheets"],
e49e8ab
-      env.paths.sort
e49e8ab
+    assert_includes(env.paths, "#{ROOT}/javascripts")
e49e8ab
+    assert_includes(env.paths, "#{ROOT}/stylesheets")
e49e8ab
+    assert_includes(env.paths, "#{ROOT}/app/assets/config")
e49e8ab
   end
e49e8ab
 
e49e8ab
   def test_compressors
e49e8ab
@@ -220,8 +222,10 @@ def test_configure
e49e8ab
     app.initialize!
e49e8ab
 
e49e8ab
     assert env = app.assets
e49e8ab
-    assert_equal ["#{ROOT}/app/assets/config", "#{ROOT}/javascripts", "#{ROOT}/stylesheets"],
e49e8ab
-      env.paths.sort
e49e8ab
+
e49e8ab
+    assert_includes(env.paths, "#{ROOT}/javascripts")
e49e8ab
+    assert_includes(env.paths, "#{ROOT}/stylesheets")
e49e8ab
+    assert_includes(env.paths, "#{ROOT}/app/assets/config")
e49e8ab
   end
e49e8ab
 
e49e8ab
   def test_environment_is_frozen_if_caching_classes
e49e8ab
@@ -381,8 +385,9 @@ def test_direct_build_environment_call
e49e8ab
     assert_kind_of Sprockets::Environment, env
e49e8ab
 
e49e8ab
     assert_equal ROOT, env.root
e49e8ab
-    assert_equal ["#{ROOT}/app/assets/config", "#{ROOT}/javascripts", "#{ROOT}/stylesheets"],
e49e8ab
-      env.paths.sort
e49e8ab
+    assert_includes(env.paths, "#{ROOT}/javascripts")
e49e8ab
+    assert_includes(env.paths, "#{ROOT}/stylesheets")
e49e8ab
+    assert_includes(env.paths, "#{ROOT}/app/assets/config")
e49e8ab
   end
e49e8ab
 
e49e8ab
   def test_quiet_assets_defaults_to_off