@@ -29,38 +29,31 @@ def remove_compilation_digest_path
29
29
end
30
30
31
31
it "is stale when host changes" do
32
- # allow(Shakapacker.config).to receive(:fetch).with(any_args).and_call_original
33
- # allow(Shakapacker.config).to receive(:fetch).with(:compiler_strategy_asset_host_sensitive).and_return(true)
32
+ old_host = Shakapacker ::Compiler . env [ "SHAKAPACKER_ASSET_HOST" ]
34
33
35
- ENV [ "SHAKAPACKER_ASSET_HOST" ] = "the-host"
34
+ Shakapacker :: Compiler . env [ "SHAKAPACKER_ASSET_HOST" ] = "the-host"
36
35
37
36
@digest_strategy . after_compile_hook
38
37
39
- ENV [ "SHAKAPACKER_ASSET_HOST" ] = "new-host"
38
+ Shakapacker :: Compiler . env [ "SHAKAPACKER_ASSET_HOST" ] = "new-host"
40
39
41
40
expect ( @digest_strategy . stale? ) . to be true
42
41
expect ( @digest_strategy . fresh? ) . to be_falsey
43
42
44
- ENV [ "SHAKAPACKER_ASSET_HOST" ] = nil
43
+ Shakapacker :: Compiler . env [ "SHAKAPACKER_ASSET_HOST" ] = old_host
45
44
end
46
45
47
46
it "generates correct compilation_digest_path" do
48
- actual_path = @digest_strategy . send ( :compilation_digest_path ) . basename . to_s
49
- expected_path = "last-compilation-digest-#{ Shakapacker . env } "
50
-
51
- expect ( actual_path ) . to eq expected_path
52
- end
53
-
54
- it "generates correct compilation_digest_path with " do
55
- # allow(Shakapacker.config).to receive(:fetch).with(any_args).and_call_original
56
- # allow(Shakapacker.config).to receive(:fetch).with(:compiler_strategy_asset_host_sensitive).and_return(true)
47
+ old_host = Shakapacker ::Compiler . env [ "SHAKAPACKER_ASSET_HOST" ]
57
48
58
- ENV [ "SHAKAPACKER_ASSET_HOST" ] = "custom-path"
49
+ Shakapacker :: Compiler . env [ "SHAKAPACKER_ASSET_HOST" ] = "custom-path"
59
50
60
51
actual_path = @digest_strategy . send ( :compilation_digest_path ) . basename . to_s
61
- host_hash = Digest ::SHA1 . hexdigest ( "- custom-path" )
52
+ host_hash = Digest ::SHA1 . hexdigest ( "custom-path" )
62
53
expected_path = "last-compilation-digest-#{ Shakapacker . env } -#{ host_hash } "
63
54
64
55
expect ( actual_path ) . to eq expected_path
56
+
57
+ Shakapacker ::Compiler . env [ "SHAKAPACKER_ASSET_HOST" ] = old_host
65
58
end
66
59
end
0 commit comments