File tree 2 files changed +17
-3
lines changed
2 files changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -74,8 +74,8 @@ def configure(&block)
74
74
app . assets . version ,
75
75
config . assets . version ,
76
76
config . action_controller . relative_url_root ,
77
- config . action_controller . asset_host ,
78
- Sprockets ::Rails ::VERSION ,
77
+ ( config . action_controller . asset_host unless config . action_controller . asset_host . respond_to? ( :call ) ) ,
78
+ Sprockets ::Rails ::VERSION
79
79
] . compact . join ( '-' )
80
80
81
81
# Copy config.assets.paths to Sprockets
Original file line number Diff line number Diff line change @@ -112,7 +112,7 @@ def test_version
112
112
assert_equal "test-v2-#{ Sprockets ::Rails ::VERSION } " , env . version
113
113
end
114
114
115
- def test_version_fragments
115
+ def test_version_fragments_with_string_asset_host
116
116
app . configure do
117
117
config . assets . version = 'v2'
118
118
config . action_controller . asset_host = 'http://some-cdn.com'
@@ -124,6 +124,20 @@ def test_version_fragments
124
124
assert_equal "test-v2-some-path-http://some-cdn.com-#{ Sprockets ::Rails ::VERSION } " , env . version
125
125
end
126
126
127
+ def test_version_fragments_with_proc_asset_host
128
+ app . configure do
129
+ config . assets . version = 'v2'
130
+ config . action_controller . asset_host = -> ( path , request ) {
131
+ 'http://some-cdn.com'
132
+ }
133
+ config . action_controller . relative_url_root = 'some-path'
134
+ end
135
+ app . initialize!
136
+
137
+ assert env = app . assets
138
+ assert_equal "test-v2-some-path-#{ Sprockets ::Rails ::VERSION } " , env . version
139
+ end
140
+
127
141
def test_configure
128
142
app . configure do
129
143
config . assets . configure do |env |
You can’t perform that action at this time.
0 commit comments