2017-08-12 08:32:15 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-08-11 13:18:12 -04:00
|
|
|
require "test_helper"
|
|
|
|
require "database/setup"
|
|
|
|
|
|
|
|
class ActiveStorage::BlobsControllerTest < ActionDispatch::IntegrationTest
|
|
|
|
setup do
|
2017-09-28 16:43:37 -04:00
|
|
|
@blob = create_file_blob filename: "racecar.jpg"
|
2017-08-11 13:18:12 -04:00
|
|
|
end
|
|
|
|
|
2017-12-15 19:26:53 -05:00
|
|
|
test "showing blob with invalid signed ID" do
|
|
|
|
get rails_service_blob_url("invalid", "racecar.jpg")
|
|
|
|
assert_response :not_found
|
|
|
|
end
|
|
|
|
|
2017-08-11 13:18:12 -04:00
|
|
|
test "showing blob utilizes browser caching" do
|
|
|
|
get rails_blob_url(@blob)
|
|
|
|
|
2017-08-14 09:17:50 -04:00
|
|
|
assert_redirected_to(/racecar\.jpg/)
|
2017-08-11 13:18:12 -04:00
|
|
|
assert_equal "max-age=300, private", @response.headers["Cache-Control"]
|
|
|
|
end
|
|
|
|
end
|