Skip to content

Commit 65b7e13

Browse files
committed
Fix test suite compatibility with propshaft 1.2.0
The newer version has a different manifest schema.
1 parent 7f309f0 commit 65b7e13

File tree

2 files changed

+37
-44
lines changed

2 files changed

+37
-44
lines changed

Gemfile.lock

Lines changed: 26 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -154,12 +154,12 @@ GEM
154154
beaneater (~> 1.0)
155155
concurrent-ruby (~> 1.0, >= 1.0.1)
156156
dante (> 0.1.5)
157-
base64 (0.2.0)
157+
base64 (0.3.0)
158158
bcrypt (3.1.20)
159159
bcrypt_pbkdf (1.1.1)
160160
beaneater (1.1.3)
161-
benchmark (0.4.0)
162-
bigdecimal (3.1.9)
161+
benchmark (0.4.1)
162+
bigdecimal (3.2.2)
163163
bindex (0.8.1)
164164
bootsnap (1.18.4)
165165
msgpack (~> 1.2)
@@ -185,8 +185,8 @@ GEM
185185
concurrent-ruby
186186
childprocess (5.1.0)
187187
logger (~> 1.5)
188-
concurrent-ruby (1.3.4)
189-
connection_pool (2.5.0)
188+
concurrent-ruby (1.3.5)
189+
connection_pool (2.5.3)
190190
crack (1.0.0)
191191
bigdecimal
192192
rexml
@@ -206,7 +206,7 @@ GEM
206206
digest-crc (0.6.5)
207207
rake (>= 12.0.0, < 14.0.0)
208208
dotenv (3.1.7)
209-
drb (2.2.1)
209+
drb (2.2.3)
210210
ed25519 (1.3.0)
211211
erubi (1.13.1)
212212
et-orbi (1.2.11)
@@ -306,7 +306,7 @@ GEM
306306
hashdiff (1.1.2)
307307
httpclient (2.9.0)
308308
mutex_m
309-
i18n (1.14.6)
309+
i18n (1.14.7)
310310
concurrent-ruby (~> 1.0)
311311
image_processing (1.13.0)
312312
mini_magick (>= 4.9.5, < 5)
@@ -315,8 +315,9 @@ GEM
315315
actionpack (>= 6.0.0)
316316
activesupport (>= 6.0.0)
317317
railties (>= 6.0.0)
318-
io-console (0.8.0)
319-
irb (1.14.3)
318+
io-console (0.8.1)
319+
irb (1.15.2)
320+
pp (>= 0.6.0)
320321
rdoc (>= 4.0.0)
321322
reline (>= 0.4.2)
322323
jbuilder (2.13.0)
@@ -352,8 +353,8 @@ GEM
352353
listen (3.9.0)
353354
rb-fsevent (~> 0.10, >= 0.10.3)
354355
rb-inotify (~> 0.9, >= 0.9.10)
355-
logger (1.6.5)
356-
loofah (2.24.0)
356+
logger (1.7.0)
357+
loofah (2.24.1)
357358
crass (~> 1.0.2)
358359
nokogiri (>= 1.12.0)
359360
mail (2.8.1)
@@ -371,8 +372,8 @@ GEM
371372
mixlib-shellout
372373
mini_magick (4.13.2)
373374
mini_mime (1.1.5)
374-
mini_portile2 (2.8.8)
375-
minitest (5.25.4)
375+
mini_portile2 (2.8.9)
376+
minitest (5.25.5)
376377
minitest-bisect (1.7.0)
377378
minitest-server (~> 1.0)
378379
path_expander (~> 1.1)
@@ -413,25 +414,9 @@ GEM
413414
net-protocol
414415
net-ssh (7.3.0)
415416
nio4r (2.7.4)
416-
nokogiri (1.18.1)
417+
nokogiri (1.18.8)
417418
mini_portile2 (~> 2.8.2)
418419
racc (~> 1.4)
419-
nokogiri (1.18.1-aarch64-linux-gnu)
420-
racc (~> 1.4)
421-
nokogiri (1.18.1-aarch64-linux-musl)
422-
racc (~> 1.4)
423-
nokogiri (1.18.1-arm-linux-gnu)
424-
racc (~> 1.4)
425-
nokogiri (1.18.1-arm-linux-musl)
426-
racc (~> 1.4)
427-
nokogiri (1.18.1-arm64-darwin)
428-
racc (~> 1.4)
429-
nokogiri (1.18.1-x86_64-darwin)
430-
racc (~> 1.4)
431-
nokogiri (1.18.1-x86_64-linux-gnu)
432-
racc (~> 1.4)
433-
nokogiri (1.18.1-x86_64-linux-musl)
434-
racc (~> 1.4)
435420
os (1.1.4)
436421
ostruct (0.6.1)
437422
parallel (1.26.3)
@@ -440,13 +425,15 @@ GEM
440425
racc
441426
path_expander (1.1.3)
442427
pg (1.5.9)
428+
pp (0.6.2)
429+
prettyprint
430+
prettyprint (0.2.0)
443431
prism (1.3.0)
444-
propshaft (1.1.0)
432+
propshaft (1.2.0)
445433
actionpack (>= 7.0.0)
446434
activesupport (>= 7.0.0)
447435
rack
448-
railties (>= 7.0.0)
449-
psych (5.2.5)
436+
psych (5.2.6)
450437
date
451438
stringio
452439
public_suffix (6.0.1)
@@ -456,14 +443,14 @@ GEM
456443
pg (>= 1.1, < 2.0)
457444
raabro (1.4.0)
458445
racc (1.8.1)
459-
rack (3.1.8)
446+
rack (3.1.16)
460447
rack-cache (1.17.0)
461448
rack (>= 0.4)
462449
rack-protection (4.1.1)
463450
base64 (>= 0.1.0)
464451
logger (>= 1.6.0)
465452
rack (>= 3.0.0, < 4)
466-
rack-session (2.1.0)
453+
rack-session (2.1.1)
467454
base64 (>= 0.1.0)
468455
rack (>= 3.0.0)
469456
rack-test (2.2.0)
@@ -478,7 +465,7 @@ GEM
478465
loofah (~> 2.21)
479466
nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
480467
rainbow (3.1.1)
481-
rake (13.2.1)
468+
rake (13.3.0)
482469
rb-fsevent (0.11.2)
483470
rb-inotify (0.11.1)
484471
ffi (~> 1.0)
@@ -493,7 +480,7 @@ GEM
493480
redis-namespace (1.11.0)
494481
redis (>= 4)
495482
regexp_parser (2.10.0)
496-
reline (0.6.0)
483+
reline (0.6.1)
497484
io-console (~> 0.5)
498485
representable (3.2.0)
499486
declarative (< 0.1.0)
@@ -692,7 +679,7 @@ GEM
692679
unicode-display_width (3.1.4)
693680
unicode-emoji (~> 4.0, >= 4.0.4)
694681
unicode-emoji (4.0.4)
695-
uri (1.0.2)
682+
uri (1.0.3)
696683
useragent (0.16.11)
697684
w3c_validators (1.3.7)
698685
json (>= 1.8)
@@ -720,7 +707,7 @@ GEM
720707
websocket-extensions (0.1.5)
721708
xpath (3.2.0)
722709
nokogiri (~> 1.8)
723-
zeitwerk (2.7.1)
710+
zeitwerk (2.7.3)
724711

725712
PLATFORMS
726713
aarch64-linux

railties/test/application/assets_test.rb

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,8 @@ class User < ActiveRecord::Base; raise 'should not be reached'; end
138138

139139
manifest = Dir["#{app_path}/public/assets/.manifest.json"].first
140140
assets = ActiveSupport::JSON.decode(File.read(manifest))
141-
assert_match(/application-([0-z]+)\.css/, assets["application.css"])
142-
assert_match(/rails-([0-z]+)\.png/, assets["rails.png"])
141+
assert_match(/application-([0-z]+)\.css/, digested_path(assets, "application.css"))
142+
assert_match(/rails-([0-z]+)\.png/, digested_path(assets, "rails.png"))
143143
end
144144

145145
test "the manifest file should be saved by default in the same assets folder" do
@@ -150,7 +150,7 @@ class User < ActiveRecord::Base; raise 'should not be reached'; end
150150

151151
manifest = Dir["#{app_path}/public/x/.manifest.json"].first
152152
assets = ActiveSupport::JSON.decode(File.read(manifest))
153-
assert_match(/test-([0-z]+)\.css/, assets["test.css"])
153+
assert_match(/test-([0-z]+)\.css/, digested_path(assets, "test.css"))
154154
end
155155

156156
test "assets do not require any assets group gem when manifest file is present" do
@@ -161,7 +161,7 @@ class User < ActiveRecord::Base; raise 'should not be reached'; end
161161

162162
manifest = Dir["#{app_path}/public/assets/.manifest.json"].first
163163
assets = ActiveSupport::JSON.decode(File.read(manifest))
164-
asset_path = assets["application.js"]
164+
asset_path = digested_path(assets, "application.js")
165165

166166
# Load app env
167167
app "production"
@@ -223,7 +223,8 @@ class User < ActiveRecord::Base; raise 'should not be reached'; end
223223

224224
manifest = Dir["#{app_path}/public/assets/.manifest.json"].first
225225
assets = ActiveSupport::JSON.decode(File.read(manifest))
226-
assert asset_path = assets.find { |(k, _)| /.png/.match?(k) }[1]
226+
assert asset = assets.find { |(k, _)| /.png/.match?(k) }[1]
227+
asset_path = asset.is_a?(Hash) ? asset["digested_path"] : asset
227228

228229
# Load app env
229230
app "development"
@@ -314,6 +315,11 @@ class ::PostsController < ActionController::Base; end
314315
end
315316

316317
private
318+
def digested_path(assets, name)
319+
asset = assets[name]
320+
asset.is_a?(Hash) ? asset["digested_path"] : asset
321+
end
322+
317323
def app_with_assets_in_view
318324
app_file "app/assets/javascripts/application.js", "function f1() { alert(); }"
319325
app_file "app/views/posts/index.html.erb", "<%= javascript_include_tag 'application' %>"

0 commit comments

Comments
 (0)