Merge pull request #1593 from internetee/upgrade-rails-to-6.0.3

Upgrade Rails from 5.2 to 6.0.3
This commit is contained in:
Timo Võhmar 2020-06-03 15:04:36 +03:00 committed by GitHub
commit 2ffe9629f9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
34 changed files with 272 additions and 112 deletions

View file

@ -1,8 +1,9 @@
source 'https://rubygems.org'
# core
gem 'bootsnap', '>= 1.1.0', require: false
gem 'iso8601', '0.12.1' # for dates and times
gem 'rails', '~> 5.2.4.2'
gem 'rails', '~> 6.0'
gem 'rest-client'
gem 'uglifier'
@ -10,7 +11,7 @@ gem 'uglifier'
gem 'figaro', '1.1.1'
# model related
gem 'paper_trail', '~> 9.2'
gem 'paper_trail', '~> 10.3'
gem 'pg', '1.2.2'
# 1.8 is for Rails < 5.0
gem 'ransack', '~> 2.3'
@ -23,12 +24,12 @@ gem 'nokogiri'
# style
gem 'bootstrap-sass', '~> 3.4'
gem 'sass-rails', '5.0.6' # sass style
gem 'coffee-rails', '~> 4.2'
gem 'jquery-rails'
gem 'selectize-rails', '0.12.1' # include selectize.js for select
gem 'kaminari'
gem 'coderay', '1.1.0' # xml console visualize
gem 'sass-rails'
gem 'select2-rails', '3.5.9.3' # for autocomplete
gem 'cancancan'
gem 'devise', '~> 4.7'
@ -72,6 +73,7 @@ gem 'directo', github: 'internetee/directo', branch: 'master'
group :development do
# deploy
gem 'listen', '3.2.1'
gem 'mina', '0.3.1' # for fast deployment
end

View file

@ -68,47 +68,61 @@ GIT
GEM
remote: https://rubygems.org/
specs:
actioncable (5.2.4.2)
actionpack (= 5.2.4.2)
actioncable (6.0.3.1)
actionpack (= 6.0.3.1)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
actionmailer (5.2.4.2)
actionpack (= 5.2.4.2)
actionview (= 5.2.4.2)
activejob (= 5.2.4.2)
actionmailbox (6.0.3.1)
actionpack (= 6.0.3.1)
activejob (= 6.0.3.1)
activerecord (= 6.0.3.1)
activestorage (= 6.0.3.1)
activesupport (= 6.0.3.1)
mail (>= 2.7.1)
actionmailer (6.0.3.1)
actionpack (= 6.0.3.1)
actionview (= 6.0.3.1)
activejob (= 6.0.3.1)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0)
actionpack (5.2.4.2)
actionview (= 5.2.4.2)
activesupport (= 5.2.4.2)
actionpack (6.0.3.1)
actionview (= 6.0.3.1)
activesupport (= 6.0.3.1)
rack (~> 2.0, >= 2.0.8)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
actionview (5.2.4.2)
activesupport (= 5.2.4.2)
rails-html-sanitizer (~> 1.0, >= 1.2.0)
actiontext (6.0.3.1)
actionpack (= 6.0.3.1)
activerecord (= 6.0.3.1)
activestorage (= 6.0.3.1)
activesupport (= 6.0.3.1)
nokogiri (>= 1.8.5)
actionview (6.0.3.1)
activesupport (= 6.0.3.1)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.3)
activejob (5.2.4.2)
activesupport (= 5.2.4.2)
rails-html-sanitizer (~> 1.1, >= 1.2.0)
activejob (6.0.3.1)
activesupport (= 6.0.3.1)
globalid (>= 0.3.6)
activemodel (5.2.4.2)
activesupport (= 5.2.4.2)
activerecord (5.2.4.2)
activemodel (= 5.2.4.2)
activesupport (= 5.2.4.2)
arel (>= 9.0)
activestorage (5.2.4.2)
actionpack (= 5.2.4.2)
activerecord (= 5.2.4.2)
activemodel (6.0.3.1)
activesupport (= 6.0.3.1)
activerecord (6.0.3.1)
activemodel (= 6.0.3.1)
activesupport (= 6.0.3.1)
activestorage (6.0.3.1)
actionpack (= 6.0.3.1)
activejob (= 6.0.3.1)
activerecord (= 6.0.3.1)
marcel (~> 0.3.1)
activesupport (5.2.4.2)
activesupport (6.0.3.1)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2)
minitest (~> 5.1)
tzinfo (~> 1.1)
zeitwerk (~> 2.2, >= 2.2.2)
addressable (2.7.0)
public_suffix (>= 2.0.2, < 5.0)
airbrake (10.0.1)
@ -118,7 +132,6 @@ GEM
akami (1.3.1)
gyoku (>= 0.4.0)
nokogiri
arel (9.0.0)
autodoc (0.7.3)
actionpack
activesupport (>= 3.0.0)
@ -126,6 +139,8 @@ GEM
autoprefixer-rails (9.7.4)
execjs
bcrypt (3.1.13)
bootsnap (1.4.6)
msgpack (~> 1.0)
bootstrap-sass (3.4.1)
autoprefixer-rails (>= 5.2.1)
sassc (>= 2.0.0)
@ -250,6 +265,9 @@ GEM
kaminari-core (1.2.1)
keystores (0.4.0)
libxml-ruby (3.1.0)
listen (3.2.1)
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
logger (1.4.2)
loofah (2.5.0)
crass (~> 1.0.2)
@ -262,13 +280,13 @@ GEM
mime-types (3.3.1)
mime-types-data (~> 3.2015)
mime-types-data (3.2019.1009)
mimemagic (0.3.4)
mimemagic (0.3.5)
mina (0.3.1)
open4 (~> 1.3.4)
rake
mini_mime (1.0.2)
mini_portile2 (2.4.0)
minitest (5.14.0)
minitest (5.14.1)
monetize (1.9.4)
money (~> 6.12)
money (6.13.7)
@ -278,6 +296,7 @@ GEM
monetize (~> 1.9.0)
money (~> 6.13.2)
railties (>= 3.0)
msgpack (1.3.3)
multi_json (1.14.1)
mustermann (1.1.1)
ruby2_keywords (~> 0.0.1)
@ -290,11 +309,9 @@ GEM
nori (2.6.0)
open4 (1.3.4)
orm_adapter (0.5.0)
paper_trail (9.2.0)
activerecord (>= 4.2, < 5.3)
paper_trail-association_tracking (< 2)
paper_trail (10.3.1)
activerecord (>= 4.2)
request_store (~> 1.1)
paper_trail-association_tracking (1.1.1)
pdfkit (0.8.4.1)
pg (1.2.2)
polyamorous (2.3.2)
@ -319,18 +336,20 @@ GEM
rack-test (1.1.0)
rack (>= 1.0, < 3)
railroady (1.3.0)
rails (5.2.4.2)
actioncable (= 5.2.4.2)
actionmailer (= 5.2.4.2)
actionpack (= 5.2.4.2)
actionview (= 5.2.4.2)
activejob (= 5.2.4.2)
activemodel (= 5.2.4.2)
activerecord (= 5.2.4.2)
activestorage (= 5.2.4.2)
activesupport (= 5.2.4.2)
rails (6.0.3.1)
actioncable (= 6.0.3.1)
actionmailbox (= 6.0.3.1)
actionmailer (= 6.0.3.1)
actionpack (= 6.0.3.1)
actiontext (= 6.0.3.1)
actionview (= 6.0.3.1)
activejob (= 6.0.3.1)
activemodel (= 6.0.3.1)
activerecord (= 6.0.3.1)
activestorage (= 6.0.3.1)
activesupport (= 6.0.3.1)
bundler (>= 1.3.0)
railties (= 5.2.4.2)
railties (= 6.0.3.1)
sprockets-rails (>= 2.0.0)
rails-dom-testing (2.0.3)
activesupport (>= 4.2.0)
@ -339,19 +358,19 @@ GEM
loofah (~> 2.3)
rails-settings-cached (0.7.2)
rails (>= 4.2.0)
railties (5.2.4.2)
actionpack (= 5.2.4.2)
activesupport (= 5.2.4.2)
railties (6.0.3.1)
actionpack (= 6.0.3.1)
activesupport (= 6.0.3.1)
method_source
rake (>= 0.8.7)
thor (>= 0.19.0, < 2.0)
thor (>= 0.20.3, < 2.0)
rake (13.0.1)
ransack (2.3.2)
activerecord (>= 5.2.1)
activesupport (>= 5.2.1)
i18n
polyamorous (= 2.3.2)
rb-fsevent (0.10.3)
rb-fsevent (0.10.4)
rb-inotify (0.10.1)
ffi (~> 1.0)
rbtree3 (0.6.0)
@ -383,19 +402,16 @@ GEM
ruby2_keywords (0.0.2)
rubyzip (2.2.0)
safe_yaml (1.0.5)
sass (3.7.4)
sass-listen (~> 4.0.0)
sass-listen (4.0.0)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
sass-rails (5.0.6)
railties (>= 4.0.0, < 6)
sass (~> 3.1)
sprockets (>= 2.8, < 4.0)
sprockets-rails (>= 2.0, < 4.0)
tilt (>= 1.1, < 3)
sass-rails (6.0.0)
sassc-rails (~> 2.1, >= 2.1.1)
sassc (2.2.1)
ffi (~> 1.9)
sassc-rails (2.1.2)
railties (>= 4.0.0)
sassc (>= 2.0)
sprockets (> 3.0)
sprockets-rails
tilt
savon (2.12.0)
akami (~> 1.2)
builder (>= 2.1.2)
@ -427,7 +443,7 @@ GEM
sixarm_ruby_unaccent (1.2.0)
slop (3.6.0)
socksify (1.7.1)
sprockets (3.7.2)
sprockets (4.0.0)
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
sprockets-rails (3.2.1)
@ -461,7 +477,7 @@ GEM
addressable (>= 2.3.6)
crack (>= 0.3.2)
hashdiff (>= 0.4.0, < 2.0.0)
websocket-driver (0.7.1)
websocket-driver (0.7.2)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.4)
whenever (0.9.4)
@ -469,6 +485,7 @@ GEM
wkhtmltopdf-binary (0.12.5.1)
xpath (3.2.0)
nokogiri (~> 1.8)
zeitwerk (2.3.0)
PLATFORMS
ruby
@ -476,6 +493,7 @@ PLATFORMS
DEPENDENCIES
airbrake
autodoc
bootsnap (>= 1.1.0)
bootstrap-sass (~> 3.4)
cancancan
capybara
@ -502,11 +520,12 @@ DEPENDENCIES
jquery-ui-rails (= 5.0.5)
kaminari
lhv!
listen (= 3.2.1)
mina (= 0.3.1)
minitest (~> 5.14)
money-rails
nokogiri
paper_trail (~> 9.2)
paper_trail (~> 10.3)
pdfkit
pg (= 1.2.2)
pry (= 0.10.1)
@ -514,11 +533,11 @@ DEPENDENCIES
que
que-web
railroady (= 1.3.0)
rails (~> 5.2.4.2)
rails (~> 6.0)
rails-settings-cached (= 0.7.2)
ransack (~> 2.3)
rest-client
sass-rails (= 5.0.6)
sass-rails
sdoc (= 0.4.1)
select2-rails (= 3.5.9.3)
selectize-rails (= 0.12.1)

View file

@ -1,6 +1,6 @@
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
require File.expand_path('../config/application', __FILE__)
require_relative 'config/application'
Rails.application.load_tasks

View file

@ -0,0 +1,3 @@
//= link_tree ../images
//= link_directory ../javascripts .js
//= link_directory ../stylesheets .css

View file

@ -44,7 +44,7 @@ module Api
# This controller does not inherit from ApplicationController,
# so user_for_paper_trail method is not usable.
def set_paper_trail_whodunnit
::PaperTrail.whodunnit = current_registrant_user.id_role_username
::PaperTrail.request.whodunnit = current_registrant_user.id_role_username
end
def show_not_found_error

View file

@ -118,7 +118,7 @@ module Epp
end
def render_epp_response(*args)
@response = render_to_string(*args, formats: 'xml')
@response = render_to_string(*args, formats: [:xml])
render xml: @response
write_to_epp_log
end

View file

@ -1,6 +1,6 @@
class DomainDeleteConfirmJob < Que::Job
def run(domain_id, action, initiator = nil)
::PaperTrail.whodunnit = "job - #{self.class.name} - #{action} by #{initiator}"
::PaperTrail.request.whodunnit = "job - #{self.class.name} - #{action} by #{initiator}"
# it's recommended to keep transaction against job table as short as possible.
ActiveRecord::Base.transaction do
domain = Epp::Domain.find(domain_id)

View file

@ -3,7 +3,7 @@ class DomainDeleteJob < Que::Job
def run(domain_id)
domain = Domain.find(domain_id)
::PaperTrail.whodunnit = "job - #{self.class.name}"
::PaperTrail.request.whodunnit = "job - #{self.class.name}"
WhoisRecord.where(domain_id: domain.id).destroy_all
domain.destroy

View file

@ -1,6 +1,6 @@
class DomainUpdateConfirmJob < Que::Job
def run(domain_id, action, initiator = nil)
::PaperTrail.whodunnit = "job - #{self.class.name} - #{action} by #{initiator}"
::PaperTrail.request.whodunnit = "job - #{self.class.name} - #{action} by #{initiator}"
# it's recommended to keep transaction against job table as short as possible.
ActiveRecord::Base.transaction do
domain = Epp::Domain.find(domain_id)

View file

@ -1,5 +1,5 @@
class Action < ApplicationRecord
has_paper_trail class_name: 'ActionVersion'
has_paper_trail versions: { class_name: 'ActionVersion' }
belongs_to :user
belongs_to :contact
@ -16,4 +16,4 @@ class Action < ApplicationRecord
raise 'Action object is missing' unless contact
"contact_#{operation}".to_sym
end
end
end

View file

@ -7,7 +7,7 @@ module Concerns
def start_client_hold
log_prepare_client_hold
::PaperTrail.whodunnit = "cron - #{__method__}"
::PaperTrail.request.whodunnit = "cron - #{__method__}"
::Domain.force_delete_scheduled.each do |domain|
proceed_client_hold(domain: domain)

View file

@ -7,9 +7,10 @@ module Versions
attr_accessor :version_loader
if WITH_CHILDREN.include?(model_name.name)
has_paper_trail class_name: "#{model_name}Version", meta: { children: :children_log }
has_paper_trail versions: { class_name: "#{model_name}Version" },
meta: { children: :children_log }
else
has_paper_trail class_name: "#{model_name}Version"
has_paper_trail versions: { class_name: "#{model_name}Version" }
end
# add creator and updator
@ -18,12 +19,12 @@ module Versions
before_update :add_updator
def add_creator
self.creator_str = ::PaperTrail.whodunnit
self.creator_str = ::PaperTrail.request.whodunnit
true
end
def add_updator
self.updator_str = ::PaperTrail.whodunnit
self.updator_str = ::PaperTrail.request.whodunnit
true
end
@ -51,11 +52,11 @@ module Versions
# callbacks
def touch_domain_version
domain.paper_trail.try(:touch_with_version)
domain.try(:touch)
end
def touch_domains_version
domains.each { |domain| domain.paper_trail.touch_with_version }
domains.each(&:touch)
end
end

View file

@ -6,7 +6,7 @@ class DomainCron
def self.clean_expired_pendings
STDOUT << "#{Time.zone.now.utc} - Clean expired domain pendings\n" unless Rails.env.test?
::PaperTrail.whodunnit = "cron - #{__method__}"
::PaperTrail.request.whodunnit = "cron - #{__method__}"
expire_at = Setting.expire_pending_confirmation.hours.ago
count = 0
expired_pending_domains = Domain.where('registrant_verification_asked_at <= ?', expire_at)
@ -38,7 +38,7 @@ class DomainCron
end
def self.start_expire_period
::PaperTrail.whodunnit = "cron - #{__method__}"
::PaperTrail.request.whodunnit = "cron - #{__method__}"
domains = Domain.expired
marked = 0
real = 0
@ -64,7 +64,7 @@ class DomainCron
def self.start_redemption_grace_period
STDOUT << "#{Time.zone.now.utc} - Setting server_hold to domains\n" unless Rails.env.test?
::PaperTrail.whodunnit = "cron - #{__method__}"
::PaperTrail.request.whodunnit = "cron - #{__method__}"
domains = Domain.outzone_candidates
marked = 0

View file

@ -58,7 +58,7 @@ class LegalDocument < ApplicationRecord
end
def add_creator
self.creator_str = ::PaperTrail.whodunnit
self.creator_str = ::PaperTrail.request.whodunnit
true
end

View file

@ -1,7 +1,7 @@
# Used in Registrant portal to collect registrant verifications
# Registrant postgres user can access this table directly.
class RegistrantVerification < ApplicationRecord
has_paper_trail class_name: 'RegistrantVerificationVersion'
has_paper_trail versions: { class_name: 'RegistrantVerificationVersion' }
# actions
CONFIRMED = 'confirmed'

View file

@ -1,6 +1,6 @@
# This file is used by Rack-based servers to start the application.
require ::File.expand_path('../config/environment', __FILE__)
require_relative 'config/environment'
run Rails.application
# turn automatic que temp off

View file

@ -16,7 +16,9 @@ end
module DomainNameRegistry
class Application < Rails::Application
config.load_defaults 5.1
config.load_defaults 6.0
config.autoloader = :classic # Do not use zeitwerk for now
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded.

View file

@ -1,3 +1,4 @@
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
require 'bundler/setup' # Set up gems listed in the Gemfile.
require 'bootsnap/setup'

View file

@ -0,0 +1,66 @@
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
# since you don't have to restart the web server when you make code changes.
config.cache_classes = false
config.autoload = :classic
# Do not eager load code on boot.
config.eager_load = false
# Show full error reports.
config.consider_all_requests_local = true
# Enable/disable caching. By default caching is disabled.
# Run rails dev:cache to toggle caching.
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 = :null_store
end
# Store uploaded files on the local file system (see config/storage.yml for options).
config.active_storage.service = :local
# Don't care if the mailer can't send.
config.action_mailer.raise_delivery_errors = false
config.action_mailer.perform_caching = false
# Print deprecation notices to the Rails logger.
config.active_support.deprecation = :log
# Raise an error on page load if there are pending migrations.
config.active_record.migration_error = :page_load
# Highlight code that triggered database queries in logs.
config.active_record.verbose_query_logs = true
# Debug mode disables concatenation and preprocessing of assets.
# This option may cause significant delays in view rendering with a large
# number of complex assets.
config.assets.debug = true
# Suppress logger output for asset requests.
config.assets.quiet = true
# Allow any host to access development
config.hosts.clear
# Raises error for missing translations.
# config.action_view.raise_on_missing_translations = 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
end

View file

@ -0,0 +1,45 @@
# Be sure to restart your server when you modify this file.
#
# This file contains migration options to ease your Rails 6.0 upgrade.
#
# Once upgraded flip defaults one by one to migrate to the new default.
#
# Read the Guide for Upgrading Ruby on Rails for more info on each option.
# Don't force requests from old versions of IE to be UTF-8 encoded.
Rails.application.config.action_view.default_enforce_utf8 = false
# Embed purpose and expiry metadata inside signed and encrypted
# cookies for increased security.
#
# This option is not backwards compatible with earlier Rails versions.
# It's best enabled when your entire app is migrated and stable on 6.0.
# Rails.application.config.action_dispatch.use_cookies_with_metadata = true
# Change the return value of `ActionDispatch::Response#content_type` to Content-Type header without modification.
Rails.application.config.action_dispatch.return_only_media_type_on_content_type = false
# Return false instead of self when enqueuing is aborted from a callback.
Rails.application.config.active_job.return_false_on_aborted_enqueue = true
# Send Active Storage analysis and purge jobs to dedicated queues.
# Rails.application.config.active_storage.queues.analysis = :active_storage_analysis
# Rails.application.config.active_storage.queues.purge = :active_storage_purge
# When assigning to a collection of attachments declared via `has_many_attached`, replace existing
# attachments instead of appending. Use #attach to add new attachments without replacing existing ones.
# Rails.application.config.active_storage.replace_on_assign_to_many = true
# Use ActionMailer::MailDeliveryJob for sending parameterized and normal mail.
#
# The default delivery jobs (ActionMailer::Parameterized::DeliveryJob, ActionMailer::DeliveryJob),
# will be removed in Rails 6.1. This setting is not backwards compatible with earlier Rails versions.
# If you send mail in the background, job workers need to have a copy of
# MailDeliveryJob to ensure all delivery jobs are processed properly.
# Make sure your entire app is migrated and stable on 6.0 before using this setting.
# Rails.application.config.action_mailer.delivery_job = "ActionMailer::MailDeliveryJob"
# Enable the same cache key to be reused when the object being cached of type
# `ActiveRecord::Relation` changes by moving the volatile information (max updated at and count)
# of the relation's cache key into the cache version to support recycling cache key.
Rails.application.config.active_record.collection_cache_versioning = true

View file

@ -0,0 +1,7 @@
Que::Adapters::Base::CAST_PROCS[1184] = lambda do |value|
case value
when Time then value
when String then Time.parse(value)
else raise "Unexpected time class: #{value.class} (#{value.inspect})"
end
end

View file

@ -0,0 +1,10 @@
# This migration comes from active_storage (originally 20180723000244)
class AddForeignKeyConstraintToActiveStorageAttachmentsForBlobId < ActiveRecord::Migration[6.0]
def up
return if foreign_key_exists?(:active_storage_attachments, column: :blob_id)
if table_exists?(:active_storage_blobs)
add_foreign_key :active_storage_attachments, :active_storage_blobs, column: :blob_id
end
end
end

View file

@ -1,6 +1,6 @@
---
--- PostgreSQL database dump
---
----
---- PostgreSQL database dump
----
SET statement_timeout = 0;
SET lock_timeout = 0;
@ -4522,6 +4522,7 @@ INSERT INTO "schema_migrations" (version) VALUES
('20200421093637'),
('20200505103316'),
('20200505150413'),
('20200518104105');
('20200518104105'),
('20200529115011');

View file

@ -1,9 +1,9 @@
# Store console and rake changes in versions
if defined?(::Rails::Console)
PaperTrail.whodunnit = "console-#{`whoami`.strip}"
PaperTrail.request.whodunnit = "console-#{`whoami`.strip}"
elsif File.basename($PROGRAM_NAME) == 'rake'
# rake username does not work when spring enabled
PaperTrail.whodunnit = "rake-#{`whoami`.strip} #{ARGV.join ' '}"
PaperTrail.request.whodunnit = "rake-#{`whoami`.strip} #{ARGV.join ' '}"
end
class PaperSession

View file

@ -13,7 +13,7 @@ class AdminAreaInvoicesIntegrationTest < ApplicationIntegrationTest
assert_response :ok
assert_equal 'application/pdf', response.headers['Content-Type']
assert_equal 'attachment; filename="invoice-1.pdf"', response.headers['Content-Disposition']
assert_equal "attachment; filename=\"invoice-1.pdf\"; filename*=UTF-8''invoice-1.pdf", response.headers['Content-Disposition']
assert_not_empty response.body
end
end
end

View file

@ -21,7 +21,7 @@ class AdminAreaZonesIntegrationTest < ApplicationIntegrationTest
assert_response :ok
assert_equal 'text/plain', response.headers['Content-Type']
assert_equal 'attachment; filename="test.txt"', response.headers['Content-Disposition']
assert_equal "attachment; filename=\"test.txt\"; filename*=UTF-8''test.txt", response.headers['Content-Disposition']
assert_not_empty response.body
end
end

View file

@ -10,7 +10,7 @@ class RegistrantAreaDomainsIntegrationTest < ApplicationIntegrationTest
assert_response :ok
assert_equal "#{Mime[:csv]}; charset=utf-8", response.headers['Content-Type']
assert_equal 'attachment; filename="domains.csv"', response.headers['Content-Disposition']
assert_equal "attachment; filename=\"domains.csv\"; filename*=UTF-8''domains.csv", response.headers['Content-Disposition']
assert_not_empty response.body
end
@ -19,7 +19,7 @@ class RegistrantAreaDomainsIntegrationTest < ApplicationIntegrationTest
assert_response :ok
assert_equal Mime[:pdf], response.headers['Content-Type']
assert_equal 'attachment; filename="domains.pdf"', response.headers['Content-Disposition']
assert_equal "attachment; filename=\"domains.pdf\"; filename*=UTF-8''domains.pdf", response.headers['Content-Disposition']
assert_not_empty response.body
end
end

View file

@ -10,7 +10,7 @@ class RegistrarAreaContactsIntegrationTest < ApplicationIntegrationTest
assert_response :ok
assert_equal "#{Mime[:csv]}; charset=utf-8", response.headers['Content-Type']
assert_equal 'attachment; filename="contacts.csv"', response.headers['Content-Disposition']
assert_equal "attachment; filename=\"contacts.csv\"; filename*=UTF-8''contacts.csv", response.headers['Content-Disposition']
assert_not_empty response.body
end
@ -19,7 +19,7 @@ class RegistrarAreaContactsIntegrationTest < ApplicationIntegrationTest
assert_response :ok
assert_equal Mime[:pdf], response.headers['Content-Type']
assert_equal 'attachment; filename="contacts.pdf"', response.headers['Content-Disposition']
assert_equal "attachment; filename=\"contacts.pdf\"; filename*=UTF-8''contacts.pdf", response.headers['Content-Disposition']
assert_not_empty response.body
end
end

View file

@ -13,7 +13,7 @@ class RegistrarAreaDomainsIntegrationTest < ApplicationIntegrationTest
assert_response :ok
assert_equal "#{Mime[:csv]}; charset=utf-8", response.headers['Content-Type']
assert_equal %(attachment; filename="Domains_#{l(now, format: :filename)}.csv"),
assert_equal %(attachment; filename="Domains_#{l(now, format: :filename)}.csv"; filename*=UTF-8''Domains_#{l(now, format: :filename)}.csv),
response.headers['Content-Disposition']
assert_not_empty response.body
end

View file

@ -13,7 +13,7 @@ class RegistrarAreaInvoicesIntegrationTest < ApplicationIntegrationTest
assert_response :ok
assert_equal 'application/pdf', response.headers['Content-Type']
assert_equal 'attachment; filename="invoice-1.pdf"', response.headers['Content-Disposition']
assert_equal "attachment; filename=\"invoice-1.pdf\"; filename*=UTF-8''invoice-1.pdf", response.headers['Content-Disposition']
assert_not_empty response.body
end
end
end

View file

@ -9,7 +9,7 @@ class PaperTrailLearningTest < ActiveSupport::TestCase
ActiveRecord::Base.connection.create_table :posts do |t|
t.string :title
# Otherwise `touch_with_version` fails silently
# Otherwise `touch` fails silently
t.datetime :updated_at
end
end
@ -55,11 +55,11 @@ class PaperTrailLearningTest < ActiveSupport::TestCase
assert_equal 'update', version.event
end
def test_touch_with_version
def test_touch
@record = Post.create!(title: 'any')
assert_difference -> { @record.versions.size } do
@record.paper_trail.touch_with_version
@record.touch
end
end
end

View file

@ -16,7 +16,7 @@ class DomainVersionTest < ActiveSupport::TestCase
def test_assigns_creator_to_paper_trail_whodunnit
duplicate_domain = prepare_duplicate_domain
PaperTrail.whodunnit = @user.id_role_username
PaperTrail.request.whodunnit = @user.id_role_username
assert_difference 'duplicate_domain.versions.count', 1 do
duplicate_domain.save!
end
@ -28,7 +28,7 @@ class DomainVersionTest < ActiveSupport::TestCase
end
def test_assigns_updator_to_paper_trail_whodunnit
PaperTrail.whodunnit = @user.id_role_username
PaperTrail.request.whodunnit = @user.id_role_username
assert_difference '@domain.versions.count', 1 do
@domain.apply_registry_lock

View file

@ -15,7 +15,7 @@ class RegistrarDomainsTest < ApplicationSystemTestCase
visit registrar_domains_url
click_button 'Download CSV'
assert_equal 'attachment; filename="Domains_2010-07-05_10.30.csv"', response_headers['Content-Disposition']
assert_equal "attachment; filename=\"Domains_2010-07-05_10.30.csv\"; filename*=UTF-8''Domains_2010-07-05_10.30.csv", response_headers['Content-Disposition']
assert_equal expected_csv, page.body
end
end

View file

@ -10,7 +10,7 @@ if ENV['COVERAGE']
end
ENV['RAILS_ENV'] ||= 'test'
require File.expand_path('../../config/environment', __FILE__)
require_relative '../config/environment'
require 'rails/test_help'
require 'minitest/mock'
require 'capybara/rails'
@ -42,6 +42,9 @@ CompanyRegister::Client = CompanyRegisterClientStub
EInvoice.provider = EInvoice::Providers::TestProvider.new
class ActiveSupport::TestCase
# Run tests in parallel with specified workers
parallelize(workers: :number_of_processors)
ActiveRecord::Migration.check_pending!
fixtures :all