diff options
Diffstat (limited to 'activestorage/test/controllers/blobs_controller_test.rb')
-rw-r--r-- | activestorage/test/controllers/blobs_controller_test.rb | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/activestorage/test/controllers/blobs_controller_test.rb b/activestorage/test/controllers/blobs_controller_test.rb new file mode 100644 index 0000000000..9c811df895 --- /dev/null +++ b/activestorage/test/controllers/blobs_controller_test.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +require "test_helper" +require "database/setup" + +class ActiveStorage::BlobsControllerTest < ActionDispatch::IntegrationTest + setup do + @blob = create_file_blob filename: "racecar.jpg" + end + + test "showing blob with invalid signed ID" do + get rails_service_blob_url("invalid", "racecar.jpg") + assert_response :not_found + end + + test "showing blob utilizes browser caching" do + get rails_blob_url(@blob) + + assert_redirected_to(/racecar\.jpg/) + assert_equal "max-age=300, private", @response.headers["Cache-Control"] + end +end |