aboutsummaryrefslogtreecommitdiffstats
path: root/activestorage
diff options
context:
space:
mode:
authorKoichi ITO <koic.ito@gmail.com>2017-08-12 21:32:15 +0900
committerKoichi ITO <koic.ito@gmail.com>2017-08-12 21:43:42 +0900
commitd02844f2499be488d262bc274530ec44e242fd70 (patch)
tree7ff85210a7d93db94509bf12bd5e520f46c59e96 /activestorage
parent98360a96cc1e0bb6ab9eb31f421a36439e66eefc (diff)
downloadrails-d02844f2499be488d262bc274530ec44e242fd70.tar.gz
rails-d02844f2499be488d262bc274530ec44e242fd70.tar.bz2
rails-d02844f2499be488d262bc274530ec44e242fd70.zip
Use frozen string literal in Active Storage
Diffstat (limited to 'activestorage')
-rw-r--r--activestorage/Rakefile2
-rw-r--r--activestorage/app/controllers/active_storage/blobs_controller.rb2
-rw-r--r--activestorage/app/controllers/active_storage/direct_uploads_controller.rb2
-rw-r--r--activestorage/app/controllers/active_storage/disk_controller.rb2
-rw-r--r--activestorage/app/controllers/active_storage/variants_controller.rb2
-rw-r--r--activestorage/app/jobs/active_storage/purge_job.rb2
-rw-r--r--activestorage/app/models/active_storage/attachment.rb2
-rw-r--r--activestorage/app/models/active_storage/blob.rb2
-rw-r--r--activestorage/app/models/active_storage/filename.rb2
-rw-r--r--activestorage/app/models/active_storage/variant.rb2
-rw-r--r--activestorage/app/models/active_storage/variation.rb2
-rw-r--r--activestorage/config/routes.rb2
-rw-r--r--activestorage/db/migrate/20170806125915_create_active_storage_tables.rb2
-rw-r--r--activestorage/lib/active_storage.rb2
-rw-r--r--activestorage/lib/active_storage/attached.rb2
-rw-r--r--activestorage/lib/active_storage/attached/macros.rb2
-rw-r--r--activestorage/lib/active_storage/attached/many.rb2
-rw-r--r--activestorage/lib/active_storage/attached/one.rb2
-rw-r--r--activestorage/lib/active_storage/gem_version.rb2
-rw-r--r--activestorage/lib/active_storage/log_subscriber.rb4
-rw-r--r--activestorage/lib/active_storage/service.rb2
-rw-r--r--activestorage/lib/active_storage/service/azure_storage_service.rb2
-rw-r--r--activestorage/lib/active_storage/service/configurator.rb2
-rw-r--r--activestorage/lib/active_storage/service/disk_service.rb2
-rw-r--r--activestorage/lib/active_storage/service/gcs_service.rb2
-rw-r--r--activestorage/lib/active_storage/service/mirror_service.rb2
-rw-r--r--activestorage/lib/active_storage/service/s3_service.rb2
-rw-r--r--activestorage/lib/active_storage/version.rb2
-rw-r--r--activestorage/lib/tasks/activestorage.rake2
-rw-r--r--activestorage/test/controllers/blobs_controller_test.rb2
-rw-r--r--activestorage/test/controllers/direct_uploads_controller_test.rb2
-rw-r--r--activestorage/test/controllers/disk_controller_test.rb2
-rw-r--r--activestorage/test/controllers/variants_controller_test.rb2
-rw-r--r--activestorage/test/database/create_users_migration.rb2
-rw-r--r--activestorage/test/database/setup.rb2
-rw-r--r--activestorage/test/dummy/Rakefile2
-rw-r--r--activestorage/test/dummy/app/controllers/application_controller.rb2
-rw-r--r--activestorage/test/dummy/app/helpers/application_helper.rb2
-rw-r--r--activestorage/test/dummy/app/jobs/application_job.rb2
-rw-r--r--activestorage/test/dummy/app/models/application_record.rb2
-rwxr-xr-xactivestorage/test/dummy/bin/bundle2
-rwxr-xr-xactivestorage/test/dummy/bin/rails2
-rwxr-xr-xactivestorage/test/dummy/bin/rake2
-rwxr-xr-xactivestorage/test/dummy/bin/yarn2
-rw-r--r--activestorage/test/dummy/config.ru2
-rw-r--r--activestorage/test/dummy/config/application.rb2
-rw-r--r--activestorage/test/dummy/config/boot.rb2
-rw-r--r--activestorage/test/dummy/config/environment.rb2
-rw-r--r--activestorage/test/dummy/config/environments/development.rb2
-rw-r--r--activestorage/test/dummy/config/environments/production.rb2
-rw-r--r--activestorage/test/dummy/config/environments/test.rb2
-rw-r--r--activestorage/test/dummy/config/initializers/application_controller_renderer.rb1
-rw-r--r--activestorage/test/dummy/config/initializers/assets.rb2
-rw-r--r--activestorage/test/dummy/config/initializers/backtrace_silencers.rb1
-rw-r--r--activestorage/test/dummy/config/initializers/cookies_serializer.rb2
-rw-r--r--activestorage/test/dummy/config/initializers/filter_parameter_logging.rb2
-rw-r--r--activestorage/test/dummy/config/initializers/inflections.rb1
-rw-r--r--activestorage/test/dummy/config/initializers/mime_types.rb1
-rw-r--r--activestorage/test/dummy/config/initializers/wrap_parameters.rb2
-rw-r--r--activestorage/test/dummy/config/routes.rb2
-rw-r--r--activestorage/test/dummy/config/spring.rb2
-rw-r--r--activestorage/test/filename_test.rb6
-rw-r--r--activestorage/test/models/attachments_test.rb2
-rw-r--r--activestorage/test/models/blob_test.rb2
-rw-r--r--activestorage/test/models/variant_test.rb2
-rw-r--r--activestorage/test/service/azure_storage_service_test.rb2
-rw-r--r--activestorage/test/service/configurator_test.rb2
-rw-r--r--activestorage/test/service/disk_service_test.rb2
-rw-r--r--activestorage/test/service/gcs_service_test.rb2
-rw-r--r--activestorage/test/service/mirror_service_test.rb2
-rw-r--r--activestorage/test/service/s3_service_test.rb2
-rw-r--r--activestorage/test/service/shared_service_tests.rb4
-rw-r--r--activestorage/test/template/image_tag_test.rb2
-rw-r--r--activestorage/test/test_helper.rb2
74 files changed, 148 insertions, 4 deletions
diff --git a/activestorage/Rakefile b/activestorage/Rakefile
index a41e07f373..aa71a65f6e 100644
--- a/activestorage/Rakefile
+++ b/activestorage/Rakefile
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require "bundler/setup"
require "bundler/gem_tasks"
require "rake/testtask"
diff --git a/activestorage/app/controllers/active_storage/blobs_controller.rb b/activestorage/app/controllers/active_storage/blobs_controller.rb
index cff88bd488..00aa8567c8 100644
--- a/activestorage/app/controllers/active_storage/blobs_controller.rb
+++ b/activestorage/app/controllers/active_storage/blobs_controller.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
# Take a signed permanent reference for a blob and turn it into an expiring service URL for download.
# Note: These URLs are publicly accessible. If you need to enforce access protection beyond the
# security-through-obscurity factor of the signed blob references, you'll need to implement your own
diff --git a/activestorage/app/controllers/active_storage/direct_uploads_controller.rb b/activestorage/app/controllers/active_storage/direct_uploads_controller.rb
index 0d93985897..205d173648 100644
--- a/activestorage/app/controllers/active_storage/direct_uploads_controller.rb
+++ b/activestorage/app/controllers/active_storage/direct_uploads_controller.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
# Creates a new blob on the server side in anticipation of a direct-to-service upload from the client side.
# When the client-side upload is completed, the signed_blob_id can be submitted as part of the form to reference
# the blob that was created up front.
diff --git a/activestorage/app/controllers/active_storage/disk_controller.rb b/activestorage/app/controllers/active_storage/disk_controller.rb
index 76377a0f20..b10d4e2cac 100644
--- a/activestorage/app/controllers/active_storage/disk_controller.rb
+++ b/activestorage/app/controllers/active_storage/disk_controller.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
# Serves files stored with the disk service in the same way that the cloud services do.
# This means using expiring, signed URLs that are meant for immediate access, not permanent linking.
# Always go through the BlobsController, or your own authenticated controller, rather than directly
diff --git a/activestorage/app/controllers/active_storage/variants_controller.rb b/activestorage/app/controllers/active_storage/variants_controller.rb
index b72b0ff7f5..02e3010626 100644
--- a/activestorage/app/controllers/active_storage/variants_controller.rb
+++ b/activestorage/app/controllers/active_storage/variants_controller.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
# Take a signed permanent reference for a variant and turn it into an expiring service URL for download.
# Note: These URLs are publicly accessible. If you need to enforce access protection beyond the
# security-through-obscurity factor of the signed blob and variation reference, you'll need to implement your own
diff --git a/activestorage/app/jobs/active_storage/purge_job.rb b/activestorage/app/jobs/active_storage/purge_job.rb
index b504ee0df4..404ccefd05 100644
--- a/activestorage/app/jobs/active_storage/purge_job.rb
+++ b/activestorage/app/jobs/active_storage/purge_job.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
# Provides delayed purging of attachments or blobs using their +#purge_later+ method.
class ActiveStorage::PurgeJob < ActiveJob::Base
# FIXME: Limit this to a custom ActiveStorage error
diff --git a/activestorage/app/models/active_storage/attachment.rb b/activestorage/app/models/active_storage/attachment.rb
index 07b5733ff8..adfa6d4aa5 100644
--- a/activestorage/app/models/active_storage/attachment.rb
+++ b/activestorage/app/models/active_storage/attachment.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require "active_support/core_ext/module/delegation"
# Attachments associate records with blobs. Usually that's a one record-many blobs relationship,
diff --git a/activestorage/app/models/active_storage/blob.rb b/activestorage/app/models/active_storage/blob.rb
index 113a7f774d..dc91a9265f 100644
--- a/activestorage/app/models/active_storage/blob.rb
+++ b/activestorage/app/models/active_storage/blob.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
# A blob is a record that contains the metadata about a file and a key for where that file resides on the service.
# Blobs can be created in two ways:
#
diff --git a/activestorage/app/models/active_storage/filename.rb b/activestorage/app/models/active_storage/filename.rb
index 35f4a8ac59..6a9889addf 100644
--- a/activestorage/app/models/active_storage/filename.rb
+++ b/activestorage/app/models/active_storage/filename.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
# Encapsulates a string representing a filename to provide convenience access to parts of it and a sanitized version.
# This is what's returned by `ActiveStorage::Blob#filename`. A Filename instance is comparable so it can be used for sorting.
class ActiveStorage::Filename
diff --git a/activestorage/app/models/active_storage/variant.rb b/activestorage/app/models/active_storage/variant.rb
index b9b93b4c1b..7b4ca18c8c 100644
--- a/activestorage/app/models/active_storage/variant.rb
+++ b/activestorage/app/models/active_storage/variant.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
# Image blobs can have variants that are the result of a set of transformations applied to the original.
# These variants are used to create thumbnails, fixed-size avatars, or any other derivative image from the
# original.
diff --git a/activestorage/app/models/active_storage/variation.rb b/activestorage/app/models/active_storage/variation.rb
index 24168c064c..396ce85ef1 100644
--- a/activestorage/app/models/active_storage/variation.rb
+++ b/activestorage/app/models/active_storage/variation.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require "active_support/core_ext/object/inclusion"
# A set of transformations that can be applied to a blob to create a variant. This class is exposed via
diff --git a/activestorage/config/routes.rb b/activestorage/config/routes.rb
index fddbb93255..168788475c 100644
--- a/activestorage/config/routes.rb
+++ b/activestorage/config/routes.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
Rails.application.routes.draw do
get "/rails/active_storage/blobs/:signed_id/*filename" => "active_storage/blobs#show", as: :rails_service_blob
diff --git a/activestorage/db/migrate/20170806125915_create_active_storage_tables.rb b/activestorage/db/migrate/20170806125915_create_active_storage_tables.rb
index 2c7e3c5bc6..76a155f8b6 100644
--- a/activestorage/db/migrate/20170806125915_create_active_storage_tables.rb
+++ b/activestorage/db/migrate/20170806125915_create_active_storage_tables.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class CreateActiveStorageTables < ActiveRecord::Migration[5.1]
def change
create_table :active_storage_blobs do |t|
diff --git a/activestorage/lib/active_storage.rb b/activestorage/lib/active_storage.rb
index 412f08e8f5..ccc1d4a163 100644
--- a/activestorage/lib/active_storage.rb
+++ b/activestorage/lib/active_storage.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
#--
# Copyright (c) 2017 David Heinemeier Hansson
#
diff --git a/activestorage/lib/active_storage/attached.rb b/activestorage/lib/active_storage/attached.rb
index f11b62e744..e90b75afd0 100644
--- a/activestorage/lib/active_storage/attached.rb
+++ b/activestorage/lib/active_storage/attached.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require "action_dispatch"
require "action_dispatch/http/upload"
require "active_support/core_ext/module/delegation"
diff --git a/activestorage/lib/active_storage/attached/macros.rb b/activestorage/lib/active_storage/attached/macros.rb
index eb877f10c0..027112195f 100644
--- a/activestorage/lib/active_storage/attached/macros.rb
+++ b/activestorage/lib/active_storage/attached/macros.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module ActiveStorage
# Provides the class-level DSL for declaring that an Active Record model has attached blobs.
module Attached::Macros
diff --git a/activestorage/lib/active_storage/attached/many.rb b/activestorage/lib/active_storage/attached/many.rb
index cc3e70ffe2..59b7d7d559 100644
--- a/activestorage/lib/active_storage/attached/many.rb
+++ b/activestorage/lib/active_storage/attached/many.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module ActiveStorage
# Decorated proxy object representing of multiple attachments to a model.
class Attached::Many < Attached
diff --git a/activestorage/lib/active_storage/attached/one.rb b/activestorage/lib/active_storage/attached/one.rb
index 6b34b30f1c..2e5831348e 100644
--- a/activestorage/lib/active_storage/attached/one.rb
+++ b/activestorage/lib/active_storage/attached/one.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module ActiveStorage
# Representation of a single attachment to a model.
class Attached::One < Attached
diff --git a/activestorage/lib/active_storage/gem_version.rb b/activestorage/lib/active_storage/gem_version.rb
index db79c669bf..bb6241ae47 100644
--- a/activestorage/lib/active_storage/gem_version.rb
+++ b/activestorage/lib/active_storage/gem_version.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module ActiveStorage
# Returns the version of the currently loaded Active Storage as a <tt>Gem::Version</tt>
def self.gem_version
diff --git a/activestorage/lib/active_storage/log_subscriber.rb b/activestorage/lib/active_storage/log_subscriber.rb
index 5c1b8d23ef..80cc5d5c80 100644
--- a/activestorage/lib/active_storage/log_subscriber.rb
+++ b/activestorage/lib/active_storage/log_subscriber.rb
@@ -1,10 +1,12 @@
+# frozen_string_literal: true
+
require "active_support/log_subscriber"
module ActiveStorage
class LogSubscriber < ActiveSupport::LogSubscriber
def service_upload(event)
message = "Uploaded file to key: #{key_in(event)}"
- message << " (checksum: #{event.payload[:checksum]})" if event.payload[:checksum]
+ message += " (checksum: #{event.payload[:checksum]})" if event.payload[:checksum]
info event, color(message, GREEN)
end
diff --git a/activestorage/lib/active_storage/service.rb b/activestorage/lib/active_storage/service.rb
index 4dd6eb6045..ce736b8728 100644
--- a/activestorage/lib/active_storage/service.rb
+++ b/activestorage/lib/active_storage/service.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require "active_storage/log_subscriber"
module ActiveStorage
diff --git a/activestorage/lib/active_storage/service/azure_storage_service.rb b/activestorage/lib/active_storage/service/azure_storage_service.rb
index d1c62f7db1..d066deaa20 100644
--- a/activestorage/lib/active_storage/service/azure_storage_service.rb
+++ b/activestorage/lib/active_storage/service/azure_storage_service.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require "active_support/core_ext/numeric/bytes"
require "azure/storage"
require "azure/storage/core/auth/shared_access_signature"
diff --git a/activestorage/lib/active_storage/service/configurator.rb b/activestorage/lib/active_storage/service/configurator.rb
index 5d6475a8ae..39951fd026 100644
--- a/activestorage/lib/active_storage/service/configurator.rb
+++ b/activestorage/lib/active_storage/service/configurator.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module ActiveStorage
class Service::Configurator #:nodoc:
attr_reader :configurations
diff --git a/activestorage/lib/active_storage/service/disk_service.rb b/activestorage/lib/active_storage/service/disk_service.rb
index 9498761cc5..cf4019966f 100644
--- a/activestorage/lib/active_storage/service/disk_service.rb
+++ b/activestorage/lib/active_storage/service/disk_service.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require "fileutils"
require "pathname"
require "digest/md5"
diff --git a/activestorage/lib/active_storage/service/gcs_service.rb b/activestorage/lib/active_storage/service/gcs_service.rb
index 0707f26a74..32dfb4851b 100644
--- a/activestorage/lib/active_storage/service/gcs_service.rb
+++ b/activestorage/lib/active_storage/service/gcs_service.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require "google/cloud/storage"
require "active_support/core_ext/object/to_query"
diff --git a/activestorage/lib/active_storage/service/mirror_service.rb b/activestorage/lib/active_storage/service/mirror_service.rb
index 8491df4911..39e922f7ab 100644
--- a/activestorage/lib/active_storage/service/mirror_service.rb
+++ b/activestorage/lib/active_storage/service/mirror_service.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require "active_support/core_ext/module/delegation"
module ActiveStorage
diff --git a/activestorage/lib/active_storage/service/s3_service.rb b/activestorage/lib/active_storage/service/s3_service.rb
index b25eb409ef..98c9dd2972 100644
--- a/activestorage/lib/active_storage/service/s3_service.rb
+++ b/activestorage/lib/active_storage/service/s3_service.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require "aws-sdk"
require "active_support/core_ext/numeric/bytes"
diff --git a/activestorage/lib/active_storage/version.rb b/activestorage/lib/active_storage/version.rb
index 8f45480712..4b6631832b 100644
--- a/activestorage/lib/active_storage/version.rb
+++ b/activestorage/lib/active_storage/version.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require_relative "gem_version"
module ActiveStorage
diff --git a/activestorage/lib/tasks/activestorage.rake b/activestorage/lib/tasks/activestorage.rake
index 7a573be596..746bc5b28a 100644
--- a/activestorage/lib/tasks/activestorage.rake
+++ b/activestorage/lib/tasks/activestorage.rake
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
namespace :activestorage do
desc "Copy over the migration needed to the application"
task install: :environment do
diff --git a/activestorage/test/controllers/blobs_controller_test.rb b/activestorage/test/controllers/blobs_controller_test.rb
index 5ec353889c..d682893e1d 100644
--- a/activestorage/test/controllers/blobs_controller_test.rb
+++ b/activestorage/test/controllers/blobs_controller_test.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require "test_helper"
require "database/setup"
diff --git a/activestorage/test/controllers/direct_uploads_controller_test.rb b/activestorage/test/controllers/direct_uploads_controller_test.rb
index 4f335c7759..888767086c 100644
--- a/activestorage/test/controllers/direct_uploads_controller_test.rb
+++ b/activestorage/test/controllers/direct_uploads_controller_test.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require "test_helper"
require "database/setup"
diff --git a/activestorage/test/controllers/disk_controller_test.rb b/activestorage/test/controllers/disk_controller_test.rb
index df7954d6b4..53a086f214 100644
--- a/activestorage/test/controllers/disk_controller_test.rb
+++ b/activestorage/test/controllers/disk_controller_test.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require "test_helper"
require "database/setup"
diff --git a/activestorage/test/controllers/variants_controller_test.rb b/activestorage/test/controllers/variants_controller_test.rb
index b3ff83e95e..d9a85e16d9 100644
--- a/activestorage/test/controllers/variants_controller_test.rb
+++ b/activestorage/test/controllers/variants_controller_test.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require "test_helper"
require "database/setup"
diff --git a/activestorage/test/database/create_users_migration.rb b/activestorage/test/database/create_users_migration.rb
index a0b72a90ee..317daa87b5 100644
--- a/activestorage/test/database/create_users_migration.rb
+++ b/activestorage/test/database/create_users_migration.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class ActiveStorageCreateUsers < ActiveRecord::Migration[5.1]
def change
create_table :users do |t|
diff --git a/activestorage/test/database/setup.rb b/activestorage/test/database/setup.rb
index 610b927cc3..87564499e6 100644
--- a/activestorage/test/database/setup.rb
+++ b/activestorage/test/database/setup.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require_relative "create_users_migration"
ActiveRecord::Base.establish_connection(adapter: "sqlite3", database: ":memory:")
diff --git a/activestorage/test/dummy/Rakefile b/activestorage/test/dummy/Rakefile
index d1baef0699..c4f9523878 100644
--- a/activestorage/test/dummy/Rakefile
+++ b/activestorage/test/dummy/Rakefile
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require_relative "config/application"
Rails.application.load_tasks
diff --git a/activestorage/test/dummy/app/controllers/application_controller.rb b/activestorage/test/dummy/app/controllers/application_controller.rb
index 1c07694e9d..280cc28ce2 100644
--- a/activestorage/test/dummy/app/controllers/application_controller.rb
+++ b/activestorage/test/dummy/app/controllers/application_controller.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
end
diff --git a/activestorage/test/dummy/app/helpers/application_helper.rb b/activestorage/test/dummy/app/helpers/application_helper.rb
index de6be7945c..15b06f0f67 100644
--- a/activestorage/test/dummy/app/helpers/application_helper.rb
+++ b/activestorage/test/dummy/app/helpers/application_helper.rb
@@ -1,2 +1,4 @@
+# frozen_string_literal: true
+
module ApplicationHelper
end
diff --git a/activestorage/test/dummy/app/jobs/application_job.rb b/activestorage/test/dummy/app/jobs/application_job.rb
index a009ace51c..d92ffddcb5 100644
--- a/activestorage/test/dummy/app/jobs/application_job.rb
+++ b/activestorage/test/dummy/app/jobs/application_job.rb
@@ -1,2 +1,4 @@
+# frozen_string_literal: true
+
class ApplicationJob < ActiveJob::Base
end
diff --git a/activestorage/test/dummy/app/models/application_record.rb b/activestorage/test/dummy/app/models/application_record.rb
index 10a4cba84d..71fbba5b32 100644
--- a/activestorage/test/dummy/app/models/application_record.rb
+++ b/activestorage/test/dummy/app/models/application_record.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class ApplicationRecord < ActiveRecord::Base
self.abstract_class = true
end
diff --git a/activestorage/test/dummy/bin/bundle b/activestorage/test/dummy/bin/bundle
index fe1874509a..277e128251 100755
--- a/activestorage/test/dummy/bin/bundle
+++ b/activestorage/test/dummy/bin/bundle
@@ -1,3 +1,5 @@
#!/usr/bin/env ruby
+# frozen_string_literal: true
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", __FILE__)
load Gem.bin_path("bundler", "bundle")
diff --git a/activestorage/test/dummy/bin/rails b/activestorage/test/dummy/bin/rails
index efc0377492..22f2d8deee 100755
--- a/activestorage/test/dummy/bin/rails
+++ b/activestorage/test/dummy/bin/rails
@@ -1,4 +1,6 @@
#!/usr/bin/env ruby
+# frozen_string_literal: true
+
APP_PATH = File.expand_path("../config/application", __dir__)
require_relative "../config/boot"
require "rails/commands"
diff --git a/activestorage/test/dummy/bin/rake b/activestorage/test/dummy/bin/rake
index 4fbf10b960..e436ea54a1 100755
--- a/activestorage/test/dummy/bin/rake
+++ b/activestorage/test/dummy/bin/rake
@@ -1,4 +1,6 @@
#!/usr/bin/env ruby
+# frozen_string_literal: true
+
require_relative "../config/boot"
require "rake"
Rake.application.run
diff --git a/activestorage/test/dummy/bin/yarn b/activestorage/test/dummy/bin/yarn
index b8fe4eeaf3..c9b7498378 100755
--- a/activestorage/test/dummy/bin/yarn
+++ b/activestorage/test/dummy/bin/yarn
@@ -1,4 +1,6 @@
#!/usr/bin/env ruby
+# frozen_string_literal: true
+
VENDOR_PATH = File.expand_path("..", __dir__)
Dir.chdir(VENDOR_PATH) do
begin
diff --git a/activestorage/test/dummy/config.ru b/activestorage/test/dummy/config.ru
index 441e6ff0c3..bff88d608a 100644
--- a/activestorage/test/dummy/config.ru
+++ b/activestorage/test/dummy/config.ru
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
# This file is used by Rack-based servers to start the application.
require_relative "config/environment"
diff --git a/activestorage/test/dummy/config/application.rb b/activestorage/test/dummy/config/application.rb
index 5c59401358..7ee6625bb5 100644
--- a/activestorage/test/dummy/config/application.rb
+++ b/activestorage/test/dummy/config/application.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require_relative "boot"
require "rails"
diff --git a/activestorage/test/dummy/config/boot.rb b/activestorage/test/dummy/config/boot.rb
index 116591a4ed..59459d4ae3 100644
--- a/activestorage/test/dummy/config/boot.rb
+++ b/activestorage/test/dummy/config/boot.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
# Set up gems listed in the Gemfile.
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../../Gemfile", __dir__)
diff --git a/activestorage/test/dummy/config/environment.rb b/activestorage/test/dummy/config/environment.rb
index cac5315775..7df99e89c6 100644
--- a/activestorage/test/dummy/config/environment.rb
+++ b/activestorage/test/dummy/config/environment.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
# Load the Rails application.
require_relative "application"
diff --git a/activestorage/test/dummy/config/environments/development.rb b/activestorage/test/dummy/config/environments/development.rb
index 5f3d463210..47fc5bf25c 100644
--- a/activestorage/test/dummy/config/environments/development.rb
+++ b/activestorage/test/dummy/config/environments/development.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
diff --git a/activestorage/test/dummy/config/environments/production.rb b/activestorage/test/dummy/config/environments/production.rb
index 343da23f0b..34ac3bc561 100644
--- a/activestorage/test/dummy/config/environments/production.rb
+++ b/activestorage/test/dummy/config/environments/production.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
diff --git a/activestorage/test/dummy/config/environments/test.rb b/activestorage/test/dummy/config/environments/test.rb
index 4f2c048600..ce0889e8ae 100644
--- a/activestorage/test/dummy/config/environments/test.rb
+++ b/activestorage/test/dummy/config/environments/test.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
diff --git a/activestorage/test/dummy/config/initializers/application_controller_renderer.rb b/activestorage/test/dummy/config/initializers/application_controller_renderer.rb
index 51639b67a0..315ac48a9a 100644
--- a/activestorage/test/dummy/config/initializers/application_controller_renderer.rb
+++ b/activestorage/test/dummy/config/initializers/application_controller_renderer.rb
@@ -1,3 +1,4 @@
+# frozen_string_literal: true
# Be sure to restart your server when you modify this file.
# ApplicationController.renderer.defaults.merge!(
diff --git a/activestorage/test/dummy/config/initializers/assets.rb b/activestorage/test/dummy/config/initializers/assets.rb
index c1f948d018..ba194685a2 100644
--- a/activestorage/test/dummy/config/initializers/assets.rb
+++ b/activestorage/test/dummy/config/initializers/assets.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
# Be sure to restart your server when you modify this file.
# Version of your assets, change this if you want to expire all your assets.
diff --git a/activestorage/test/dummy/config/initializers/backtrace_silencers.rb b/activestorage/test/dummy/config/initializers/backtrace_silencers.rb
index 59385cdf37..d0f0d3b5df 100644
--- a/activestorage/test/dummy/config/initializers/backtrace_silencers.rb
+++ b/activestorage/test/dummy/config/initializers/backtrace_silencers.rb
@@ -1,3 +1,4 @@
+# frozen_string_literal: true
# Be sure to restart your server when you modify this file.
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
diff --git a/activestorage/test/dummy/config/initializers/cookies_serializer.rb b/activestorage/test/dummy/config/initializers/cookies_serializer.rb
index 5a6a32d371..ee8dff9c99 100644
--- a/activestorage/test/dummy/config/initializers/cookies_serializer.rb
+++ b/activestorage/test/dummy/config/initializers/cookies_serializer.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
# Be sure to restart your server when you modify this file.
# Specify a serializer for the signed and encrypted cookie jars.
diff --git a/activestorage/test/dummy/config/initializers/filter_parameter_logging.rb b/activestorage/test/dummy/config/initializers/filter_parameter_logging.rb
index 4a994e1e7b..7a4f47b4c2 100644
--- a/activestorage/test/dummy/config/initializers/filter_parameter_logging.rb
+++ b/activestorage/test/dummy/config/initializers/filter_parameter_logging.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
# Be sure to restart your server when you modify this file.
# Configure sensitive parameters which will be filtered from the log file.
diff --git a/activestorage/test/dummy/config/initializers/inflections.rb b/activestorage/test/dummy/config/initializers/inflections.rb
index ac033bf9dc..aa7435fbc9 100644
--- a/activestorage/test/dummy/config/initializers/inflections.rb
+++ b/activestorage/test/dummy/config/initializers/inflections.rb
@@ -1,3 +1,4 @@
+# frozen_string_literal: true
# Be sure to restart your server when you modify this file.
# Add new inflection rules using the following format. Inflections
diff --git a/activestorage/test/dummy/config/initializers/mime_types.rb b/activestorage/test/dummy/config/initializers/mime_types.rb
index dc1899682b..6e1d16f027 100644
--- a/activestorage/test/dummy/config/initializers/mime_types.rb
+++ b/activestorage/test/dummy/config/initializers/mime_types.rb
@@ -1,3 +1,4 @@
+# frozen_string_literal: true
# Be sure to restart your server when you modify this file.
# Add new mime types for use in respond_to blocks:
diff --git a/activestorage/test/dummy/config/initializers/wrap_parameters.rb b/activestorage/test/dummy/config/initializers/wrap_parameters.rb
index bbfc3961bf..2f3c0db471 100644
--- a/activestorage/test/dummy/config/initializers/wrap_parameters.rb
+++ b/activestorage/test/dummy/config/initializers/wrap_parameters.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
# Be sure to restart your server when you modify this file.
# This file contains settings for ActionController::ParamsWrapper which
diff --git a/activestorage/test/dummy/config/routes.rb b/activestorage/test/dummy/config/routes.rb
index 1daf9a4121..edf04d2d63 100644
--- a/activestorage/test/dummy/config/routes.rb
+++ b/activestorage/test/dummy/config/routes.rb
@@ -1,2 +1,4 @@
+# frozen_string_literal: true
+
Rails.application.routes.draw do
end
diff --git a/activestorage/test/dummy/config/spring.rb b/activestorage/test/dummy/config/spring.rb
index c9119b40c0..ff5ba06b6d 100644
--- a/activestorage/test/dummy/config/spring.rb
+++ b/activestorage/test/dummy/config/spring.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
%w(
.ruby-version
.rbenv-vars
diff --git a/activestorage/test/filename_test.rb b/activestorage/test/filename_test.rb
index e448238675..f1e4a467ba 100644
--- a/activestorage/test/filename_test.rb
+++ b/activestorage/test/filename_test.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require "test_helper"
class ActiveStorage::FilenameTest < ActiveSupport::TestCase
@@ -10,8 +12,8 @@ class ActiveStorage::FilenameTest < ActiveSupport::TestCase
end
test "sanitize transcodes to valid UTF-8" do
- { "\xF6".force_encoding(Encoding::ISO8859_1) => "ö",
- "\xC3".force_encoding(Encoding::ISO8859_1) => "Ã",
+ { "\xF6".dup.force_encoding(Encoding::ISO8859_1) => "ö",
+ "\xC3".dup.force_encoding(Encoding::ISO8859_1) => "Ã",
"\xAD" => "�",
"\xCF" => "�",
"\x00" => "",
diff --git a/activestorage/test/models/attachments_test.rb b/activestorage/test/models/attachments_test.rb
index 34cd62dcde..7cfd8683db 100644
--- a/activestorage/test/models/attachments_test.rb
+++ b/activestorage/test/models/attachments_test.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require "test_helper"
require "database/setup"
diff --git a/activestorage/test/models/blob_test.rb b/activestorage/test/models/blob_test.rb
index 8b14bcec87..1c50d18994 100644
--- a/activestorage/test/models/blob_test.rb
+++ b/activestorage/test/models/blob_test.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require "test_helper"
require "database/setup"
diff --git a/activestorage/test/models/variant_test.rb b/activestorage/test/models/variant_test.rb
index 04ebaccb6a..f4e1e9e51d 100644
--- a/activestorage/test/models/variant_test.rb
+++ b/activestorage/test/models/variant_test.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require "test_helper"
require "database/setup"
diff --git a/activestorage/test/service/azure_storage_service_test.rb b/activestorage/test/service/azure_storage_service_test.rb
index a0c6a4de73..dac154cf11 100644
--- a/activestorage/test/service/azure_storage_service_test.rb
+++ b/activestorage/test/service/azure_storage_service_test.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require "service/shared_service_tests"
require "uri"
diff --git a/activestorage/test/service/configurator_test.rb b/activestorage/test/service/configurator_test.rb
index c69b8d5087..a2fd035e02 100644
--- a/activestorage/test/service/configurator_test.rb
+++ b/activestorage/test/service/configurator_test.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require "service/shared_service_tests"
class ActiveStorage::Service::ConfiguratorTest < ActiveSupport::TestCase
diff --git a/activestorage/test/service/disk_service_test.rb b/activestorage/test/service/disk_service_test.rb
index 2fdb113616..835a3a2971 100644
--- a/activestorage/test/service/disk_service_test.rb
+++ b/activestorage/test/service/disk_service_test.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require "service/shared_service_tests"
class ActiveStorage::Service::DiskServiceTest < ActiveSupport::TestCase
diff --git a/activestorage/test/service/gcs_service_test.rb b/activestorage/test/service/gcs_service_test.rb
index 03048731bc..5f53f61baf 100644
--- a/activestorage/test/service/gcs_service_test.rb
+++ b/activestorage/test/service/gcs_service_test.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require "service/shared_service_tests"
require "net/http"
diff --git a/activestorage/test/service/mirror_service_test.rb b/activestorage/test/service/mirror_service_test.rb
index 129e11d06f..93e86eff70 100644
--- a/activestorage/test/service/mirror_service_test.rb
+++ b/activestorage/test/service/mirror_service_test.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require "service/shared_service_tests"
class ActiveStorage::Service::MirrorServiceTest < ActiveSupport::TestCase
diff --git a/activestorage/test/service/s3_service_test.rb b/activestorage/test/service/s3_service_test.rb
index 57e13e6538..98f520741d 100644
--- a/activestorage/test/service/s3_service_test.rb
+++ b/activestorage/test/service/s3_service_test.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require "service/shared_service_tests"
require "net/http"
diff --git a/activestorage/test/service/shared_service_tests.rb b/activestorage/test/service/shared_service_tests.rb
index 07620d91e4..a9e1cb6ce9 100644
--- a/activestorage/test/service/shared_service_tests.rb
+++ b/activestorage/test/service/shared_service_tests.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require "test_helper"
require "active_support/core_ext/securerandom"
@@ -5,7 +7,7 @@ module ActiveStorage::Service::SharedServiceTests
extend ActiveSupport::Concern
FIXTURE_KEY = SecureRandom.base58(24)
- FIXTURE_DATA = "\211PNG\r\n\032\n\000\000\000\rIHDR\000\000\000\020\000\000\000\020\001\003\000\000\000%=m\"\000\000\000\006PLTE\000\000\000\377\377\377\245\331\237\335\000\000\0003IDATx\234c\370\377\237\341\377_\206\377\237\031\016\2603\334?\314p\1772\303\315\315\f7\215\031\356\024\203\320\275\317\f\367\201R\314\f\017\300\350\377\177\000Q\206\027(\316]\233P\000\000\000\000IEND\256B`\202".force_encoding(Encoding::BINARY)
+ FIXTURE_DATA = "\211PNG\r\n\032\n\000\000\000\rIHDR\000\000\000\020\000\000\000\020\001\003\000\000\000%=m\"\000\000\000\006PLTE\000\000\000\377\377\377\245\331\237\335\000\000\0003IDATx\234c\370\377\237\341\377_\206\377\237\031\016\2603\334?\314p\1772\303\315\315\f7\215\031\356\024\203\320\275\317\f\367\201R\314\f\017\300\350\377\177\000Q\206\027(\316]\233P\000\000\000\000IEND\256B`\202".dup.force_encoding(Encoding::BINARY)
included do
setup do
diff --git a/activestorage/test/template/image_tag_test.rb b/activestorage/test/template/image_tag_test.rb
index b285cd2e14..46dd97b3e9 100644
--- a/activestorage/test/template/image_tag_test.rb
+++ b/activestorage/test/template/image_tag_test.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require "test_helper"
require "database/setup"
diff --git a/activestorage/test/test_helper.rb b/activestorage/test/test_helper.rb
index 1190daa7b0..0bb3a925b8 100644
--- a/activestorage/test/test_helper.rb
+++ b/activestorage/test/test_helper.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require File.expand_path("../../test/dummy/config/environment.rb", __FILE__)
require "bundler/setup"