From ef53765c9166f8f42b27a310c247c34280e71168 Mon Sep 17 00:00:00 2001 From: nanaya Date: Thu, 11 Feb 2021 16:57:35 +0900 Subject: [PATCH] Update to latest rails and other gems --- Gemfile | 2 +- Gemfile.lock | 190 +++++++++--------- app/controllers/user_controller.rb | 2 - app/models/post/tag_methods.rb | 2 +- app/views/layouts/_menu.html.erb | 2 +- bin/rails | 4 +- bin/rake | 4 +- bin/setup | 8 +- bin/yarn | 12 +- config.ru | 8 +- config/application.rb | 6 +- config/environments/development.rb | 42 ++-- config/environments/production.rb | 10 +- config/environments/test.rb | 13 +- config/initializers/backtrace_silencers.rb | 7 +- .../initializers/filter_parameter_logging.rb | 4 +- config/initializers/permissions_policy.rb | 11 + test/controllers/post_controller_test.rb | 2 +- test/fixtures/files/.keep | 0 19 files changed, 192 insertions(+), 137 deletions(-) create mode 100644 config/initializers/permissions_policy.rb create mode 100644 test/fixtures/files/.keep diff --git a/Gemfile b/Gemfile index 314e2dac..7f1ff015 100644 --- a/Gemfile +++ b/Gemfile @@ -1,6 +1,6 @@ source "https://rubygems.org" -gem "rails", "~> 6.0.0" +gem "rails", "~> 6.1.0" gem "webpacker" gem "coffee-rails" diff --git a/Gemfile.lock b/Gemfile.lock index 6f0df1bf..90977acc 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,66 +1,70 @@ GEM remote: https://rubygems.org/ specs: - actioncable (6.0.3.3) - actionpack (= 6.0.3.3) + actioncable (6.1.2.1) + actionpack (= 6.1.2.1) + activesupport (= 6.1.2.1) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailbox (6.0.3.3) - actionpack (= 6.0.3.3) - activejob (= 6.0.3.3) - activerecord (= 6.0.3.3) - activestorage (= 6.0.3.3) - activesupport (= 6.0.3.3) + actionmailbox (6.1.2.1) + actionpack (= 6.1.2.1) + activejob (= 6.1.2.1) + activerecord (= 6.1.2.1) + activestorage (= 6.1.2.1) + activesupport (= 6.1.2.1) mail (>= 2.7.1) - actionmailer (6.0.3.3) - actionpack (= 6.0.3.3) - actionview (= 6.0.3.3) - activejob (= 6.0.3.3) + actionmailer (6.1.2.1) + actionpack (= 6.1.2.1) + actionview (= 6.1.2.1) + activejob (= 6.1.2.1) + activesupport (= 6.1.2.1) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) - actionpack (6.0.3.3) - actionview (= 6.0.3.3) - activesupport (= 6.0.3.3) - rack (~> 2.0, >= 2.0.8) + actionpack (6.1.2.1) + actionview (= 6.1.2.1) + activesupport (= 6.1.2.1) + rack (~> 2.0, >= 2.0.9) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.2.0) - actiontext (6.0.3.3) - actionpack (= 6.0.3.3) - activerecord (= 6.0.3.3) - activestorage (= 6.0.3.3) - activesupport (= 6.0.3.3) + actiontext (6.1.2.1) + actionpack (= 6.1.2.1) + activerecord (= 6.1.2.1) + activestorage (= 6.1.2.1) + activesupport (= 6.1.2.1) nokogiri (>= 1.8.5) - actionview (6.0.3.3) - activesupport (= 6.0.3.3) + actionview (6.1.2.1) + activesupport (= 6.1.2.1) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.1, >= 1.2.0) - activejob (6.0.3.3) - activesupport (= 6.0.3.3) + activejob (6.1.2.1) + activesupport (= 6.1.2.1) globalid (>= 0.3.6) - activemodel (6.0.3.3) - activesupport (= 6.0.3.3) - activerecord (6.0.3.3) - activemodel (= 6.0.3.3) - activesupport (= 6.0.3.3) - activerecord-jdbc-adapter (60.2-java) - activerecord (~> 6.0.0) - activerecord-jdbcpostgresql-adapter (60.2-java) - activerecord-jdbc-adapter (= 60.2) + activemodel (6.1.2.1) + activesupport (= 6.1.2.1) + activerecord (6.1.2.1) + activemodel (= 6.1.2.1) + activesupport (= 6.1.2.1) + activerecord-jdbc-adapter (61.0-java) + activerecord (~> 6.1.0) + activerecord-jdbcpostgresql-adapter (61.0-java) + activerecord-jdbc-adapter (= 61.0) jdbc-postgres (>= 9.4, < 43) - activestorage (6.0.3.3) - actionpack (= 6.0.3.3) - activejob (= 6.0.3.3) - activerecord (= 6.0.3.3) + activestorage (6.1.2.1) + actionpack (= 6.1.2.1) + activejob (= 6.1.2.1) + activerecord (= 6.1.2.1) + activesupport (= 6.1.2.1) marcel (~> 0.3.1) - activesupport (6.0.3.3) + mimemagic (~> 0.3.2) + activesupport (6.1.2.1) concurrent-ruby (~> 1.0, >= 1.0.2) - i18n (>= 0.7, < 2) - minitest (~> 5.1) - tzinfo (~> 1.1) - zeitwerk (~> 2.2, >= 2.2.2) + i18n (>= 1.6, < 2) + minitest (>= 5.1) + tzinfo (~> 2.0) + zeitwerk (~> 2.3) acts_as_versioned_rails3 (0.6.2) activerecord (>= 3.0.9) addressable (2.7.0) @@ -74,33 +78,33 @@ GEM coffee-script-source execjs coffee-script-source (1.12.2) - concurrent-ruby (1.1.7) + concurrent-ruby (1.1.8) connection_pool (2.2.3) crass (1.0.6) daemons (1.3.1) - dalli (2.7.10) + dalli (2.7.11) diff-lcs (1.4.4) - erubi (1.9.0) + erubi (1.10.0) exception_notification (4.4.3) actionmailer (>= 4.0, < 7) activesupport (>= 4.0, < 7) execjs (2.7.0) - ffi (1.13.1) - ffi (1.13.1-java) - ffi (1.13.1-x86-mingw32) + ffi (1.14.2) + ffi (1.14.2-java) + ffi (1.14.2-x86-mingw32) get_process_mem (0.2.7) ffi (~> 1.0) globalid (0.4.2) activesupport (>= 4.2.0) - i18n (1.8.5) + i18n (1.8.8) concurrent-ruby (~> 1.0) - i18n-js (3.7.1) + i18n-js (3.8.0) i18n (>= 0.6.6) - jbuilder (2.10.0) + jbuilder (2.11.2) activesupport (>= 5.0.0) jdbc-postgres (42.2.14) kgio (2.11.3) - loofah (2.7.0) + loofah (2.9.0) crass (~> 1.0.2) nokogiri (>= 1.5.9) mail (2.7.1) @@ -109,59 +113,59 @@ GEM mimemagic (~> 0.3.2) method_source (1.0.0) mimemagic (0.3.5) - mini_magick (4.10.1) + mini_magick (4.11.0) mini_mime (1.0.2) mini_portile2 (2.5.0) - minitest (5.14.2) - newrelic_rpm (6.12.0.367) - nio4r (2.5.3) - nio4r (2.5.3-java) - nokogiri (1.11.0) + minitest (5.14.3) + newrelic_rpm (6.15.0) + nio4r (2.5.5) + nio4r (2.5.5-java) + nokogiri (1.11.1) mini_portile2 (~> 2.5.0) racc (~> 1.4) - nokogiri (1.11.0-java) + nokogiri (1.11.1-java) racc (~> 1.4) - nokogiri (1.11.0-x86-mingw32) + nokogiri (1.11.1-x86-mingw32) racc (~> 1.4) non-stupid-digest-assets (1.0.9) sprockets (>= 2.0) pg (1.2.3) pg (1.2.3-x86-mingw32) - pry (0.13.1) + pry (0.14.0) coderay (~> 1.1) method_source (~> 1.0) - pry (0.13.1-java) + pry (0.14.0-java) coderay (~> 1.1) method_source (~> 1.0) spoon (~> 0.0) public_suffix (4.0.6) - puma (4.3.6) + puma (5.2.1) nio4r (~> 2.0) - puma (4.3.6-java) + puma (5.2.1-java) nio4r (~> 2.0) racc (1.5.2) racc (1.5.2-java) rack (2.2.3) - rack-mini-profiler (2.0.4) + rack-mini-profiler (2.3.1) rack (>= 1.2.0) rack-proxy (0.6.5) rack rack-test (1.1.0) rack (>= 1.0, < 3) - rails (6.0.3.3) - actioncable (= 6.0.3.3) - actionmailbox (= 6.0.3.3) - actionmailer (= 6.0.3.3) - actionpack (= 6.0.3.3) - actiontext (= 6.0.3.3) - actionview (= 6.0.3.3) - activejob (= 6.0.3.3) - activemodel (= 6.0.3.3) - activerecord (= 6.0.3.3) - activestorage (= 6.0.3.3) - activesupport (= 6.0.3.3) - bundler (>= 1.3.0) - railties (= 6.0.3.3) + rails (6.1.2.1) + actioncable (= 6.1.2.1) + actionmailbox (= 6.1.2.1) + actionmailer (= 6.1.2.1) + actionpack (= 6.1.2.1) + actiontext (= 6.1.2.1) + actionview (= 6.1.2.1) + activejob (= 6.1.2.1) + activemodel (= 6.1.2.1) + activerecord (= 6.1.2.1) + activestorage (= 6.1.2.1) + activesupport (= 6.1.2.1) + bundler (>= 1.15.0) + railties (= 6.1.2.1) sprockets-rails (>= 2.0.0) rails-controller-testing (1.0.5) actionpack (>= 5.0.1.rc1) @@ -175,14 +179,14 @@ GEM rails-i18n (6.0.0) i18n (>= 0.7, < 2) railties (>= 6.0.0, < 7) - railties (6.0.3.3) - actionpack (= 6.0.3.3) - activesupport (= 6.0.3.3) + railties (6.1.2.1) + actionpack (= 6.1.2.1) + activesupport (= 6.1.2.1) method_source rake (>= 0.8.7) - thor (>= 0.20.3, < 2.0) + thor (~> 1.0) raindrops (0.19.1) - rake (13.0.1) + rake (13.0.3) sass-rails (6.0.0) sassc-rails (~> 2.1, >= 2.1.1) sassc (2.4.0) @@ -193,7 +197,7 @@ GEM sprockets (> 3.0) sprockets-rails tilt - semantic_range (2.3.0) + semantic_range (2.3.1) sitemap_generator (6.1.2) builder (~> 3.0) spoon (0.0.6) @@ -205,15 +209,13 @@ GEM actionpack (>= 4.0) activesupport (>= 4.0) sprockets (>= 3.0.0) - thor (1.0.1) - thread_safe (0.3.6) - thread_safe (0.3.6-java) + thor (1.1.0) tilt (2.0.10) - tzinfo (1.2.7) - thread_safe (~> 0.1) + tzinfo (2.0.4) + concurrent-ruby (~> 1.0) uglifier (4.2.0) execjs (>= 0.3.0, < 3) - unicorn (5.7.0) + unicorn (5.8.0) kgio (~> 2.6) raindrops (~> 0.7) unicorn-worker-killer (0.4.4) @@ -231,7 +233,7 @@ GEM websocket-extensions (0.1.5) will-paginate-i18n (0.1.15) will_paginate (3.3.0) - zeitwerk (2.4.0) + zeitwerk (2.4.2) PLATFORMS java @@ -259,7 +261,7 @@ DEPENDENCIES pry puma rack-mini-profiler - rails (~> 6.0.0) + rails (~> 6.1.0) rails-controller-testing rails-i18n sass-rails diff --git a/app/controllers/user_controller.rb b/app/controllers/user_controller.rb index 32bfcca3..6ecd540b 100644 --- a/app/controllers/user_controller.rb +++ b/app/controllers/user_controller.rb @@ -258,12 +258,10 @@ class UserController < ApplicationController UserMailer.new_password(@user, new_password).deliver_now respond_to_success("Password reset. Check your email in a few minutes.", { :action => "login" }, :api => { :result => "success" }) - return end rescue Net::SMTPSyntaxError, Net::SMTPFatalError respond_to_success("Your email address was invalid", { :action => "login" }, :api => { :result => "invalid-email" }) - return end else @user = User.new diff --git a/app/models/post/tag_methods.rb b/app/models/post/tag_methods.rb index 4921e3c3..978a9394 100644 --- a/app/models/post/tag_methods.rb +++ b/app/models/post/tag_methods.rb @@ -52,7 +52,7 @@ module Post::TagMethods m.before_save :commit_metatags m.after_save :commit_tags m.after_save :save_post_history - m.has_many :tag_history, lambda { order "id DESC" }, :class_name => "PostTagHistory", :table_name => "post_tag_histories" + m.has_many :tag_history, lambda { order "id DESC" }, :class_name => "PostTagHistory" m.versioned :source, :default => "" m.versioned :cached_tags end diff --git a/app/views/layouts/_menu.html.erb b/app/views/layouts/_menu.html.erb index 5a1de400..5260bcc2 100644 --- a/app/views/layouts/_menu.html.erb +++ b/app/views/layouts/_menu.html.erb @@ -205,6 +205,6 @@ <% cache "forum_posts_latest", :skip_digest => true do %> <% end %> diff --git a/bin/rails b/bin/rails index 07396602..6fb4e405 100755 --- a/bin/rails +++ b/bin/rails @@ -1,4 +1,4 @@ #!/usr/bin/env ruby APP_PATH = File.expand_path('../config/application', __dir__) -require_relative '../config/boot' -require 'rails/commands' +require_relative "../config/boot" +require "rails/commands" diff --git a/bin/rake b/bin/rake index 17240489..4fbf10b9 100755 --- a/bin/rake +++ b/bin/rake @@ -1,4 +1,4 @@ #!/usr/bin/env ruby -require_relative '../config/boot' -require 'rake' +require_relative "../config/boot" +require "rake" Rake.application.run diff --git a/bin/setup b/bin/setup index 5853b5ea..90700ac4 100755 --- a/bin/setup +++ b/bin/setup @@ -1,5 +1,5 @@ #!/usr/bin/env ruby -require 'fileutils' +require "fileutils" # path to your application root. APP_ROOT = File.expand_path('..', __dir__) @@ -9,8 +9,8 @@ def system!(*args) end FileUtils.chdir APP_ROOT do - # This script is a way to setup or update your development environment automatically. - # This script is idempotent, so that you can run it at anytime and get an expectable outcome. + # This script is a way to set up or update your development environment automatically. + # This script is idempotent, so that you can run it at any time and get an expectable outcome. # Add necessary setup steps to this file. puts '== Installing dependencies ==' @@ -18,7 +18,7 @@ FileUtils.chdir APP_ROOT do system('bundle check') || system!('bundle install') # Install JavaScript dependencies - # system('bin/yarn') + system! 'bin/yarn' # puts "\n== Copying sample files ==" # unless File.exist?('config/database.yml') diff --git a/bin/yarn b/bin/yarn index 460dd565..9fab2c35 100755 --- a/bin/yarn +++ b/bin/yarn @@ -1,9 +1,15 @@ #!/usr/bin/env ruby APP_ROOT = File.expand_path('..', __dir__) Dir.chdir(APP_ROOT) do - begin - exec "yarnpkg", *ARGV - rescue Errno::ENOENT + yarn = ENV["PATH"].split(File::PATH_SEPARATOR). + select { |dir| File.expand_path(dir) != __dir__ }. + product(["yarn", "yarn.cmd", "yarn.ps1"]). + map { |dir, file| File.expand_path(file, dir) }. + find { |file| File.executable?(file) } + + if yarn + exec yarn, *ARGV + else $stderr.puts "Yarn executable was not detected in the system." $stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install" exit 1 diff --git a/config.ru b/config.ru index b6f26873..2a58fa88 100644 --- a/config.ru +++ b/config.ru @@ -5,14 +5,16 @@ if defined? Unicorn use Unicorn::WorkerKiller::Oom, (384*(1024**2)), (512*(1024**2)) end -require ::File.expand_path("../config/environment", __FILE__) +require_relative "config/environment" # Passenger hates map. And only it, AFAICT. if defined? PhusionPassenger - run Moebooru::Application + run Rails.application + Rails.application.load_server else ENV["RAILS_RELATIVE_URL_ROOT"] ||= "/" map ENV["RAILS_RELATIVE_URL_ROOT"] do - run Moebooru::Application + run Rails.application + Rails.application.load_server end end diff --git a/config/application.rb b/config/application.rb index 0cbb5f2f..7049659e 100644 --- a/config/application.rb +++ b/config/application.rb @@ -12,7 +12,7 @@ Bundler.require(*CONFIG['bundler_groups']) module Moebooru class Application < Rails::Application - config.load_defaults 6.0 + config.load_defaults 6.1 config.active_record.belongs_to_required_by_default = false # Settings in config/environments/* take precedence over those specified here. # Application configuration can go into files in config/initializers @@ -23,7 +23,7 @@ module Moebooru # config.autoload_paths += %W(#{config.root}/extras) # Also load files in lib/ in addition to app/. - config.eager_load_paths += ["#{config.root}/lib"] + config.eager_load_paths << Rails.root.join('lib') # Only load the plugins named here, in the order given (default is alphabetical). # :all can be used as a placeholder for all plugins not explicitly named. @@ -44,7 +44,7 @@ module Moebooru config.active_record.schema_format = :sql if CONFIG["memcache_servers"] - config.cache_store = :dalli_store, CONFIG["memcache_servers"], { + config.cache_store = :mem_cache_store, CONFIG["memcache_servers"], { :namespace => CONFIG["app_name"], :pool_size => CONFIG["threads"], :value_max_bytes => 2_000_000 diff --git a/config/environments/development.rb b/config/environments/development.rb index a423780b..dcb68163 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -1,8 +1,10 @@ +require "active_support/core_ext/integer/time" + Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. - # In the development environment your application's code is reloaded on - # every request. This slows down response time but is perfect for development + # In the development environment your application's code is reloaded any time + # it changes. This slows down response time but is perfect for development # since you don't have to restart the web server when you make code changes. config.cache_classes = false @@ -14,19 +16,19 @@ Rails.application.configure do # Enable/disable caching. By default caching is disabled. # Run rails dev:cache to toggle caching. - if true || Rails.root.join('tmp', 'caching-dev.txt').exist? - config.action_controller.perform_caching = true - config.action_controller.enable_fragment_cache_logging = true + # if Rails.root.join('tmp', 'caching-dev.txt').exist? + # config.action_controller.perform_caching = true + # config.action_controller.enable_fragment_cache_logging = true - config.cache_store = :memory_store - config.public_file_server.headers = { - 'Cache-Control' => "public, max-age=#{2.days.to_i}" - } - else - config.action_controller.perform_caching = false + # config.cache_store = :memory_store + # config.public_file_server.headers = { + # 'Cache-Control' => "public, max-age=#{2.days.to_i}" + # } + # else + # config.action_controller.perform_caching = false - config.cache_store = :null_store - end + # config.cache_store = :null_store + # end # Store uploaded files on the local file system (see config/storage.yml for options). config.active_storage.service = :local @@ -39,6 +41,12 @@ Rails.application.configure do # Print deprecation notices to the Rails logger. config.active_support.deprecation = :log + # Raise exceptions for disallowed deprecations. + config.active_support.disallowed_deprecation = :raise + + # Tell Active Support which deprecation messages to disallow. + config.active_support.disallowed_deprecation_warnings = [] + # Raise an error on page load if there are pending migrations. config.active_record.migration_error = :page_load @@ -54,9 +62,15 @@ Rails.application.configure do config.assets.quiet = true # Raises error for missing translations. - # config.action_view.raise_on_missing_translations = true + # config.i18n.raise_on_missing_translations = true + + # Annotate rendered view with file names. + # config.action_view.annotate_rendered_view_with_filenames = true # Use an evented file watcher to asynchronously detect changes in source code, # routes, locales, etc. This feature depends on the listen gem. # config.file_watcher = ActiveSupport::EventedFileUpdateChecker + + # Uncomment if you wish to allow Action Cable access from any origin. + # config.action_cable.disable_request_forgery_protection = true end diff --git a/config/environments/production.rb b/config/environments/production.rb index fdda3ede..146def8b 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -1,3 +1,5 @@ +require "active_support/core_ext/integer/time" + Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. @@ -30,7 +32,7 @@ Rails.application.configure do config.assets.compile = false # Enable serving of images, stylesheets, and JavaScripts from an asset server. - # config.action_controller.asset_host = 'http://assets.example.com' + # config.asset_host = 'http://assets.example.com' # Specifies the header that your server uses for sending files. # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache @@ -74,6 +76,12 @@ Rails.application.configure do # Send deprecation notices to registered listeners. config.active_support.deprecation = :notify + # Log disallowed deprecations. + config.active_support.disallowed_deprecation = :log + + # Tell Active Support which deprecation messages to disallow. + config.active_support.disallowed_deprecation_warnings = [] + # Use default logging formatter so that PID and timestamp are not suppressed. config.log_formatter = ::Logger::Formatter.new diff --git a/config/environments/test.rb b/config/environments/test.rb index 233b04ae..f1324c19 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -1,3 +1,5 @@ +require "active_support/core_ext/integer/time" + # The test environment is used exclusively to run your application's # test suite. You never need to work with it otherwise. Remember that # your test database is "scratch space" for the test suite and is wiped @@ -43,6 +45,15 @@ Rails.application.configure do # Print deprecation notices to the stderr. config.active_support.deprecation = :stderr + # Raise exceptions for disallowed deprecations. + config.active_support.disallowed_deprecation = :raise + + # Tell Active Support which deprecation messages to disallow. + config.active_support.disallowed_deprecation_warnings = [] + # Raises error for missing translations. - # config.action_view.raise_on_missing_translations = true + # config.i18n.raise_on_missing_translations = true + + # Annotate rendered view with file names. + # config.action_view.annotate_rendered_view_with_filenames = true end diff --git a/config/initializers/backtrace_silencers.rb b/config/initializers/backtrace_silencers.rb index 59385cdf..33699c30 100644 --- a/config/initializers/backtrace_silencers.rb +++ b/config/initializers/backtrace_silencers.rb @@ -1,7 +1,8 @@ # 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. -# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } +# Rails.backtrace_cleaner.add_silencer { |line| /my_noisy_library/.match?(line) } -# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code. -# Rails.backtrace_cleaner.remove_silencers! +# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code +# by setting BACKTRACE=1 before calling your invocation, like "BACKTRACE=1 ./bin/rails runner 'MyClass.perform'". +Rails.backtrace_cleaner.remove_silencers! if ENV["BACKTRACE"] diff --git a/config/initializers/filter_parameter_logging.rb b/config/initializers/filter_parameter_logging.rb index a7d12514..4b34a036 100644 --- a/config/initializers/filter_parameter_logging.rb +++ b/config/initializers/filter_parameter_logging.rb @@ -1,4 +1,6 @@ # Be sure to restart your server when you modify this file. # Configure sensitive parameters which will be filtered from the log file. -Rails.application.config.filter_parameters += [:password, :secret] +Rails.application.config.filter_parameters += [ + :passw, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn +] diff --git a/config/initializers/permissions_policy.rb b/config/initializers/permissions_policy.rb new file mode 100644 index 00000000..00f64d71 --- /dev/null +++ b/config/initializers/permissions_policy.rb @@ -0,0 +1,11 @@ +# Define an application-wide HTTP permissions policy. For further +# information see https://developers.google.com/web/updates/2018/06/feature-policy +# +# Rails.application.config.permissions_policy do |f| +# f.camera :none +# f.gyroscope :none +# f.microphone :none +# f.usb :none +# f.fullscreen :self +# f.payment :self, "https://secure.example.com" +# end diff --git a/test/controllers/post_controller_test.rb b/test/controllers/post_controller_test.rb index d7cf7cfc..eb496175 100644 --- a/test/controllers/post_controller_test.rb +++ b/test/controllers/post_controller_test.rb @@ -23,7 +23,7 @@ class PostControllerTest < ActionController::TestCase get :upload, :session => { :user_id => 3 } assert_response :success - post :create, :params => { :post => { :source => "", :file => fixture_file_upload("../mocks/test/test1.jpg"), :tags => "hoge", :rating => "Safe" } } + post :create, :params => { :post => { :source => "", :file => fixture_file_upload("../../mocks/test/test1.jpg"), :tags => "hoge", :rating => "Safe" } } p = Post.last assert_equal("hoge", p.cached_tags) assert_equal("jpg", p.file_ext) diff --git a/test/fixtures/files/.keep b/test/fixtures/files/.keep new file mode 100644 index 00000000..e69de29b