summaryrefslogtreecommitdiff
path: root/test/models/helpers/application_helper_test.rb
blob: 56096a53e25ef33cc32b5adb2dd2cccf5fc7851c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
require 'test_helper'

class ApplicationHelperTest < ActionView::TestCase
  test "mtime_busted_path appends the file's real mtime as a query param" do
    path = "/stylesheets/admin.css"
    expected_mtime = File.mtime(Rails.public_path.join("stylesheets/admin.css")).to_i

    assert_equal "#{path}?v=#{expected_mtime}", mtime_busted_path(path)
  end

  test "mtime_busted_path raises clearly for a missing file rather than silently omitting the version" do
    assert_raises(RuntimeError) { mtime_busted_path("/stylesheets/does_not_exist.css") }
  end
end