summaryrefslogtreecommitdiff
path: root/test/models
diff options
context:
space:
mode:
authorerdgeist <erdgeist@erdgeist.org>2026-07-14 16:52:03 +0200
committererdgeist <erdgeist@erdgeist.org>2026-07-14 16:53:15 +0200
commitffb3c9987c2f820b99e8ad0ad56db8ae0324671c (patch)
tree5f8ae79e6952cc6808ba5d5f827c98b6c78b62df /test/models
parentc7ed30918154d801c44f77645ead38d4759d2778 (diff)
Extend static-asset cache-busting to the public layout
mtime_busted_path only ever covered the four admin-only static files. The public layout has the identical exposure -- ccc.css, glightbox's vendored CSS/JS, and public.js are all served straight from public/ with no pipeline fingerprinting either -- just never got the same treatment.
Diffstat (limited to 'test/models')
-rw-r--r--test/models/helpers/admin_helper_test.rb10
-rw-r--r--test/models/helpers/application_helper_test.rb14
2 files changed, 14 insertions, 10 deletions
diff --git a/test/models/helpers/admin_helper_test.rb b/test/models/helpers/admin_helper_test.rb
index 94e9861..23d9f40 100644
--- a/test/models/helpers/admin_helper_test.rb
+++ b/test/models/helpers/admin_helper_test.rb
@@ -1,14 +1,4 @@
1require 'test_helper' 1require 'test_helper'
2 2
3class AdminHelperTest < ActionView::TestCase 3class AdminHelperTest < ActionView::TestCase
4 test "mtime_busted_path appends the file's real mtime as a query param" do
5 path = "/stylesheets/admin.css"
6 expected_mtime = File.mtime(Rails.public_path.join("stylesheets/admin.css")).to_i
7
8 assert_equal "#{path}?v=#{expected_mtime}", mtime_busted_path(path)
9 end
10
11 test "mtime_busted_path raises clearly for a missing file rather than silently omitting the version" do
12 assert_raises(RuntimeError) { mtime_busted_path("/stylesheets/does_not_exist.css") }
13 end
14end 4end
diff --git a/test/models/helpers/application_helper_test.rb b/test/models/helpers/application_helper_test.rb
new file mode 100644
index 0000000..56096a5
--- /dev/null
+++ b/test/models/helpers/application_helper_test.rb
@@ -0,0 +1,14 @@
1require 'test_helper'
2
3class ApplicationHelperTest < ActionView::TestCase
4 test "mtime_busted_path appends the file's real mtime as a query param" do
5 path = "/stylesheets/admin.css"
6 expected_mtime = File.mtime(Rails.public_path.join("stylesheets/admin.css")).to_i
7
8 assert_equal "#{path}?v=#{expected_mtime}", mtime_busted_path(path)
9 end
10
11 test "mtime_busted_path raises clearly for a missing file rather than silently omitting the version" do
12 assert_raises(RuntimeError) { mtime_busted_path("/stylesheets/does_not_exist.css") }
13 end
14end