From d02844f2499be488d262bc274530ec44e242fd70 Mon Sep 17 00:00:00 2001 From: Koichi ITO Date: Sat, 12 Aug 2017 21:32:15 +0900 Subject: Use frozen string literal in Active Storage --- activestorage/test/controllers/blobs_controller_test.rb | 2 ++ activestorage/test/controllers/direct_uploads_controller_test.rb | 2 ++ activestorage/test/controllers/disk_controller_test.rb | 2 ++ activestorage/test/controllers/variants_controller_test.rb | 2 ++ activestorage/test/database/create_users_migration.rb | 2 ++ activestorage/test/database/setup.rb | 2 ++ activestorage/test/dummy/Rakefile | 2 ++ activestorage/test/dummy/app/controllers/application_controller.rb | 2 ++ activestorage/test/dummy/app/helpers/application_helper.rb | 2 ++ activestorage/test/dummy/app/jobs/application_job.rb | 2 ++ activestorage/test/dummy/app/models/application_record.rb | 2 ++ activestorage/test/dummy/bin/bundle | 2 ++ activestorage/test/dummy/bin/rails | 2 ++ activestorage/test/dummy/bin/rake | 2 ++ activestorage/test/dummy/bin/yarn | 2 ++ activestorage/test/dummy/config.ru | 2 ++ activestorage/test/dummy/config/application.rb | 2 ++ activestorage/test/dummy/config/boot.rb | 2 ++ activestorage/test/dummy/config/environment.rb | 2 ++ activestorage/test/dummy/config/environments/development.rb | 2 ++ activestorage/test/dummy/config/environments/production.rb | 2 ++ activestorage/test/dummy/config/environments/test.rb | 2 ++ .../dummy/config/initializers/application_controller_renderer.rb | 1 + activestorage/test/dummy/config/initializers/assets.rb | 2 ++ activestorage/test/dummy/config/initializers/backtrace_silencers.rb | 1 + activestorage/test/dummy/config/initializers/cookies_serializer.rb | 2 ++ .../test/dummy/config/initializers/filter_parameter_logging.rb | 2 ++ activestorage/test/dummy/config/initializers/inflections.rb | 1 + activestorage/test/dummy/config/initializers/mime_types.rb | 1 + activestorage/test/dummy/config/initializers/wrap_parameters.rb | 2 ++ activestorage/test/dummy/config/routes.rb | 2 ++ activestorage/test/dummy/config/spring.rb | 2 ++ activestorage/test/filename_test.rb | 6 ++++-- activestorage/test/models/attachments_test.rb | 2 ++ activestorage/test/models/blob_test.rb | 2 ++ activestorage/test/models/variant_test.rb | 2 ++ activestorage/test/service/azure_storage_service_test.rb | 2 ++ activestorage/test/service/configurator_test.rb | 2 ++ activestorage/test/service/disk_service_test.rb | 2 ++ activestorage/test/service/gcs_service_test.rb | 2 ++ activestorage/test/service/mirror_service_test.rb | 2 ++ activestorage/test/service/s3_service_test.rb | 2 ++ activestorage/test/service/shared_service_tests.rb | 4 +++- activestorage/test/template/image_tag_test.rb | 2 ++ activestorage/test/test_helper.rb | 2 ++ 45 files changed, 89 insertions(+), 3 deletions(-) (limited to 'activestorage/test') 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" -- cgit v1.2.3