-
Notifications
You must be signed in to change notification settings - Fork 792
/
Copy pathtest_manifest_utils.rb
37 lines (27 loc) · 1.22 KB
/
test_manifest_utils.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# frozen_string_literal: true
require 'minitest/autorun'
require 'sprockets/manifest_utils'
require 'logger'
class TestManifestUtils < Minitest::Test
include Sprockets::ManifestUtils
def test_generate_manifest_path
assert_match(MANIFEST_RE, generate_manifest_path)
end
def test_find_directory_manifest
root = File.expand_path("../fixtures/manifest_utils", __FILE__)
assert_match MANIFEST_RE, File.basename(find_directory_manifest(root))
assert_equal "#{root}/default/.sprockets-manifest-f4bf345974645583d284686ddfb7625e.json",
find_directory_manifest("#{root}/default")
end
def test_warn_on_two
root = File.expand_path("../fixtures/manifest_utils", __FILE__)
assert_match MANIFEST_RE, File.basename(find_directory_manifest(root))
r, w = IO.pipe
logger = Logger.new(w)
# finds the first one alphabetically
assert_equal "#{root}/with_two_manifests/.sprockets-manifest-00000000000000000000000000000000.json",
find_directory_manifest("#{root}/with_two_manifests", logger)
output = r.gets
assert_match(/W, \[[^\]]+\] WARN -- : Found multiple manifests: .+ Choosing the first alphabetically: \.sprockets-manifest-00000000000000000000000000000000\.json/, output)
end
end