Skip to content

Commit 322c1dc

Browse files
committed
Avoid private api if metadata is exposed
1 parent 15e8e68 commit 322c1dc

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

test/test_helper.rb

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -525,11 +525,22 @@ def test_non_javascripts_and_stylesheets
525525

526526
class AutomaticDependenciesFromHelpersTest < HelperTest
527527
def test_dependency_added
528-
assert_equal ["logo.png", "url.css.erb"], @assets['url.css'].send(:dependency_paths).map {|d| File.basename(d.pathname) }.sort
528+
asset = @assets['url.css']
529+
if asset.respond_to?(:metadata)
530+
paths = asset.metadata[:dependency_paths].map { |p| File.basename(p) }.sort
531+
else
532+
paths = asset.send(:dependency_paths).map {|d| File.basename(d.pathname) }.sort
533+
end
534+
assert_equal ["logo.png", "url.css.erb"], paths
529535
end
530536

531537
def test_ignores_missing_dependencies
532-
assert_equal ["missing.css.erb"], @assets['error/missing.css'].send(:dependency_paths).map {|d| File.basename(d.pathname) }.sort
538+
asset = @assets['error/missing.css']
539+
if asset.respond_to?(:metadata)
540+
paths = asset.metadata[:dependency_paths].map { |p| File.basename(p) }.sort
541+
else
542+
paths = asset.send(:dependency_paths).map {|d| File.basename(d.pathname) }.sort
543+
end
544+
assert_equal ["missing.css.erb"], paths
533545
end
534-
535546
end

0 commit comments

Comments
 (0)