Merge pull request #9692 from colinux/fix-deprecation-warnings
Tech: fix multiple deprecation warnings
This commit is contained in:
commit
fb318620aa
17 changed files with 40 additions and 45 deletions
|
@ -161,7 +161,7 @@ GEM
|
||||||
nokogiri (~> 1.10, >= 1.10.4)
|
nokogiri (~> 1.10, >= 1.10.4)
|
||||||
rubyzip (>= 1.3.0, < 3)
|
rubyzip (>= 1.3.0, < 3)
|
||||||
charlock_holmes (0.7.7)
|
charlock_holmes (0.7.7)
|
||||||
chartkick (4.1.3)
|
chartkick (5.0.4)
|
||||||
choice (0.2.0)
|
choice (0.2.0)
|
||||||
chunky_png (1.4.0)
|
chunky_png (1.4.0)
|
||||||
clamav-client (3.2.0)
|
clamav-client (3.2.0)
|
||||||
|
@ -293,8 +293,8 @@ GEM
|
||||||
bundler (>= 1.14)
|
bundler (>= 1.14)
|
||||||
graphql (>= 1.10, < 3.0)
|
graphql (>= 1.10, < 3.0)
|
||||||
thor (>= 0.19, < 2.0)
|
thor (>= 0.19, < 2.0)
|
||||||
groupdate (5.2.2)
|
groupdate (6.4.0)
|
||||||
activesupport (>= 5)
|
activesupport (>= 6.1)
|
||||||
haml (6.0.5)
|
haml (6.0.5)
|
||||||
temple (>= 0.8.2)
|
temple (>= 0.8.2)
|
||||||
thor
|
thor
|
||||||
|
|
|
@ -177,7 +177,8 @@ class ApplicationController < ActionController::Base
|
||||||
private
|
private
|
||||||
|
|
||||||
def set_active_storage_host
|
def set_active_storage_host
|
||||||
ActiveStorage::Current.host = request.base_url
|
ActiveStorage::Current.url_options ||= {}
|
||||||
|
ActiveStorage::Current.url_options[:host] = request.base_url
|
||||||
end
|
end
|
||||||
|
|
||||||
def setup_javascript_settings
|
def setup_javascript_settings
|
||||||
|
|
|
@ -618,16 +618,12 @@ class Dossier < ApplicationRecord
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def expiration_date_with_extention
|
def expiration_date_with_extension
|
||||||
[
|
expiration_date_reference + conservation_extension + procedure.duree_conservation_dossiers_dans_ds.months
|
||||||
expiration_date_reference,
|
|
||||||
conservation_extension,
|
|
||||||
procedure.duree_conservation_dossiers_dans_ds.months
|
|
||||||
].sum
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def expiration_notification_date
|
def expiration_notification_date
|
||||||
expiration_date_with_extention - REMAINING_WEEKS_BEFORE_EXPIRATION.weeks
|
expiration_date_with_extension - REMAINING_WEEKS_BEFORE_EXPIRATION.weeks
|
||||||
end
|
end
|
||||||
|
|
||||||
def close_to_expiration?
|
def close_to_expiration?
|
||||||
|
@ -646,7 +642,7 @@ class Dossier < ApplicationRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
def expiration_date
|
def expiration_date
|
||||||
after_notification_expiration_date.presence || expiration_date_with_extention
|
after_notification_expiration_date.presence || expiration_date_with_extension
|
||||||
end
|
end
|
||||||
|
|
||||||
def duration_after_notice
|
def duration_after_notice
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
Chartkick.options = {
|
Chartkick.options = {
|
||||||
content_for: :charts_js,
|
content_for: :charts_js,
|
||||||
defer: true,
|
|
||||||
colors: ["#000091"],
|
colors: ["#000091"],
|
||||||
thousands: ' ',
|
thousands: ' ',
|
||||||
decimal: ','
|
decimal: ','
|
||||||
|
|
|
@ -53,7 +53,7 @@ RSpec.describe Manager::AdministrateurConfirmationsController, type: :controller
|
||||||
|
|
||||||
describe 'edge cases' do
|
describe 'edge cases' do
|
||||||
context 'when the environment is development' do
|
context 'when the environment is development' do
|
||||||
before { Rails.env.stub(development?: true) }
|
before { allow(Rails.env).to receive(:development?).and_return(true) }
|
||||||
|
|
||||||
context 'when the current admin is the inviter' do
|
context 'when the current admin is the inviter' do
|
||||||
before { sign_in inviter_super_admin }
|
before { sign_in inviter_super_admin }
|
||||||
|
@ -130,7 +130,7 @@ RSpec.describe Manager::AdministrateurConfirmationsController, type: :controller
|
||||||
|
|
||||||
describe 'edge cases' do
|
describe 'edge cases' do
|
||||||
context 'when the environment is development' do
|
context 'when the environment is development' do
|
||||||
before { Rails.env.stub(development?: true) }
|
before { allow(Rails.env).to receive(:development?).and_return(true) }
|
||||||
|
|
||||||
context 'when the current admin is the inviter' do
|
context 'when the current admin is the inviter' do
|
||||||
before { sign_in inviter_super_admin }
|
before { sign_in inviter_super_admin }
|
||||||
|
|
|
@ -32,7 +32,7 @@ RSpec.describe Cron::WeeklyOverviewJob, type: :job do
|
||||||
end
|
end
|
||||||
|
|
||||||
it { expect(InstructeurMailer).to have_received(:last_week_overview).with(instructeur) }
|
it { expect(InstructeurMailer).to have_received(:last_week_overview).with(instructeur) }
|
||||||
it { expect { run_job }.not_to raise_error(NoMethodError) }
|
it { expect { run_job }.not_to raise_error }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ describe ExportJob do
|
||||||
let(:format) { :zip }
|
let(:format) { :zip }
|
||||||
|
|
||||||
it 'does not try to identify file' do
|
it 'does not try to identify file' do
|
||||||
expect { subject }.not_to raise_error(ActiveStorage::FileNotFoundError)
|
expect { subject }.not_to raise_error
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -35,7 +35,7 @@ RSpec.describe BalancerDeliveryMethod do
|
||||||
end
|
end
|
||||||
|
|
||||||
def deliver!(mail)
|
def deliver!(mail)
|
||||||
Mail::CheckDeliveryParams.check(mail)
|
Mail::SmtpEnvelope.new(mail)
|
||||||
self.class.deliveries << mail
|
self.class.deliveries << mail
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -33,7 +33,7 @@ describe Recovery::AlignChampWithDossierRevision do
|
||||||
|
|
||||||
expect(fixer.logs.size).to eq(1)
|
expect(fixer.logs.size).to eq(1)
|
||||||
expect(fixer.logs.first.fetch(:status)).to eq(:updated)
|
expect(fixer.logs.first.fetch(:status)).to eq(:updated)
|
||||||
expect { DossierPreloader.load_one(bad_dossier) }.not_to raise_error(ArgumentError)
|
expect { DossierPreloader.load_one(bad_dossier) }.not_to raise_error
|
||||||
expect(bad_dossier.champs.size).to eq(2)
|
expect(bad_dossier.champs.size).to eq(2)
|
||||||
expect(bad_dossier.champs_public.size).to eq(2)
|
expect(bad_dossier.champs_public.size).to eq(2)
|
||||||
end
|
end
|
||||||
|
@ -60,7 +60,7 @@ describe Recovery::AlignChampWithDossierRevision do
|
||||||
|
|
||||||
expect(fixer.logs.size).to eq(1)
|
expect(fixer.logs.size).to eq(1)
|
||||||
expect(fixer.logs.first.fetch(:status)).to eq(:not_found)
|
expect(fixer.logs.first.fetch(:status)).to eq(:not_found)
|
||||||
expect { DossierPreloader.load_one(bad_dossier) }.not_to raise_error(ArgumentError)
|
expect { DossierPreloader.load_one(bad_dossier) }.not_to raise_error
|
||||||
expect(bad_dossier.champs.size).to eq(1)
|
expect(bad_dossier.champs.size).to eq(1)
|
||||||
expect(bad_dossier.champs_public.size).to eq(1)
|
expect(bad_dossier.champs_public.size).to eq(1)
|
||||||
end
|
end
|
||||||
|
|
|
@ -30,7 +30,7 @@ describe 'Recovery::Revision::LifeCycle' do
|
||||||
expect(dossier.champs_public.size).to eq(1)
|
expect(dossier.champs_public.size).to eq(1)
|
||||||
expect(dossier.champs.size).to eq(2)
|
expect(dossier.champs.size).to eq(2)
|
||||||
importer.load
|
importer.load
|
||||||
expect { DossierPreloader.load_one(dossier) }.not_to raise_error(ArgumentError)
|
expect { DossierPreloader.load_one(dossier) }.not_to raise_error
|
||||||
expect(dossier.champs_public.size).to eq(2)
|
expect(dossier.champs_public.size).to eq(2)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -385,7 +385,7 @@ RSpec.describe DossierCloneConcern do
|
||||||
procedure.publish_revision!
|
procedure.publish_revision!
|
||||||
end
|
end
|
||||||
it 'works' do
|
it 'works' do
|
||||||
expect { subject }.not_to raise_error(ActiveRecord::InvalidForeignKey)
|
expect { subject }.not_to raise_error
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -93,8 +93,8 @@ describe Dossier, type: :model do
|
||||||
expect(expiring_dossier.close_to_expiration?).to be_falsey
|
expect(expiring_dossier.close_to_expiration?).to be_falsey
|
||||||
expect(expiring_dossier_with_notification.close_to_expiration?).to be_falsey
|
expect(expiring_dossier_with_notification.close_to_expiration?).to be_falsey
|
||||||
|
|
||||||
expect(expiring_dossier.expiration_date).to eq(expiring_dossier.expiration_date_with_extention)
|
expect(expiring_dossier.expiration_date).to eq(expiring_dossier.expiration_date_with_extension)
|
||||||
expect(expiring_dossier_with_notification.expiration_date).to eq(expiring_dossier_with_notification.expiration_date_with_extention)
|
expect(expiring_dossier_with_notification.expiration_date).to eq(expiring_dossier_with_notification.expiration_date_with_extension)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -144,8 +144,8 @@ describe Dossier, type: :model do
|
||||||
expect(expiring_dossier.close_to_expiration?).to be_falsey
|
expect(expiring_dossier.close_to_expiration?).to be_falsey
|
||||||
expect(expiring_dossier_with_notification.close_to_expiration?).to be_falsey
|
expect(expiring_dossier_with_notification.close_to_expiration?).to be_falsey
|
||||||
|
|
||||||
expect(expiring_dossier.expiration_date).to eq(expiring_dossier.expiration_date_with_extention)
|
expect(expiring_dossier.expiration_date).to eq(expiring_dossier.expiration_date_with_extension)
|
||||||
expect(expiring_dossier_with_notification.expiration_date).to eq(expiring_dossier_with_notification.expiration_date_with_extention)
|
expect(expiring_dossier_with_notification.expiration_date).to eq(expiring_dossier_with_notification.expiration_date_with_extension)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -204,8 +204,8 @@ describe Dossier, type: :model do
|
||||||
expect(expiring_dossier.close_to_expiration?).to be_falsey
|
expect(expiring_dossier.close_to_expiration?).to be_falsey
|
||||||
expect(expiring_dossier_with_notification.close_to_expiration?).to be_falsey
|
expect(expiring_dossier_with_notification.close_to_expiration?).to be_falsey
|
||||||
|
|
||||||
expect(expiring_dossier.expiration_date).to eq(expiring_dossier.expiration_date_with_extention)
|
expect(expiring_dossier.expiration_date).to eq(expiring_dossier.expiration_date_with_extension)
|
||||||
expect(expiring_dossier_with_notification.expiration_date).to eq(expiring_dossier_with_notification.expiration_date_with_extention)
|
expect(expiring_dossier_with_notification.expiration_date).to eq(expiring_dossier_with_notification.expiration_date_with_extension)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -86,7 +86,7 @@ RSpec.configure do |config|
|
||||||
|
|
||||||
ActionMailer::Base.deliveries.clear
|
ActionMailer::Base.deliveries.clear
|
||||||
|
|
||||||
ActiveStorage::Current.host = 'http://test.host'
|
ActiveStorage::Current.url_options = { host: 'http://test.host' }
|
||||||
|
|
||||||
Geocoder.configure(lookup: :test)
|
Geocoder.configure(lookup: :test)
|
||||||
end
|
end
|
||||||
|
|
|
@ -489,7 +489,7 @@ describe ProcedureExportService do
|
||||||
subject { service.to_zip }
|
subject { service.to_zip }
|
||||||
context 'without files' do
|
context 'without files' do
|
||||||
it 'does not raises in_batches' do
|
it 'does not raises in_batches' do
|
||||||
expect { subject }.not_to raise_error(NoMethodError)
|
expect { subject }.not_to raise_error
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'returns an empty blob' do
|
it 'returns an empty blob' do
|
||||||
|
|
|
@ -1,11 +1,17 @@
|
||||||
RSpec.shared_examples 'a job retrying transient errors' do |job_class = described_class|
|
RSpec.shared_examples 'a job retrying transient errors' do |job_class = described_class|
|
||||||
context 'when a transient network error is raised' do
|
ExconErrorJob = Class.new(job_class) do
|
||||||
ExconErrorJob = Class.new(job_class) do
|
def perform
|
||||||
def perform
|
raise Excon::Error::InternalServerError, 'msg'
|
||||||
raise Excon::Error::InternalServerError, 'msg'
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
end if !defined?(ExconErrorJob)
|
||||||
|
|
||||||
|
StandardErrorJob = Class.new(job_class) do
|
||||||
|
def perform
|
||||||
|
raise StandardError
|
||||||
|
end
|
||||||
|
end if !defined?(StandardErrorJob)
|
||||||
|
|
||||||
|
context 'when a transient network error is raised' do
|
||||||
it 'makes 5 attempts before raising the exception up' do
|
it 'makes 5 attempts before raising the exception up' do
|
||||||
assert_performed_jobs 5 do
|
assert_performed_jobs 5 do
|
||||||
ExconErrorJob.perform_later rescue Excon::Error::InternalServerError
|
ExconErrorJob.perform_later rescue Excon::Error::InternalServerError
|
||||||
|
@ -14,12 +20,6 @@ RSpec.shared_examples 'a job retrying transient errors' do |job_class = describe
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when another type of error is raised' do
|
context 'when another type of error is raised' do
|
||||||
StandardErrorJob = Class.new(job_class) do
|
|
||||||
def perform
|
|
||||||
raise StandardError
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'makes only 1 attempt before raising the exception up' do
|
it 'makes only 1 attempt before raising the exception up' do
|
||||||
assert_performed_jobs 1 do
|
assert_performed_jobs 1 do
|
||||||
StandardErrorJob.perform_later rescue StandardError
|
StandardErrorJob.perform_later rescue StandardError
|
||||||
|
|
|
@ -263,8 +263,8 @@ describe 'user access to the list of their dossiers', js: true do
|
||||||
|
|
||||||
it "can be filtered by procedure and display the result - no item" do
|
it "can be filtered by procedure and display the result - no item" do
|
||||||
select dossier_brouillon.procedure.libelle, from: 'procedure_id'
|
select dossier_brouillon.procedure.libelle, from: 'procedure_id'
|
||||||
expect(page).not_to have_link(dossier_en_construction.id)
|
expect(page).not_to have_link(String(dossier_en_construction.id))
|
||||||
expect(page).not_to have_link(dossier_with_champs.id)
|
expect(page).not_to have_link(String(dossier_with_champs.id))
|
||||||
expect(page).to have_content("Résultat de la recherche pour « #{dossier_en_construction.champs_public.first.value} » et pour la procédure « #{dossier_brouillon.procedure.libelle} » ")
|
expect(page).to have_content("Résultat de la recherche pour « #{dossier_en_construction.champs_public.first.value} » et pour la procédure « #{dossier_brouillon.procedure.libelle} » ")
|
||||||
expect(page).to have_text("Aucun dossier")
|
expect(page).to have_text("Aucun dossier")
|
||||||
end
|
end
|
||||||
|
|
|
@ -7,8 +7,7 @@ describe 'users/dossiers/brouillon', type: :view do
|
||||||
before do
|
before do
|
||||||
sign_in dossier.user
|
sign_in dossier.user
|
||||||
assign(:dossier, dossier)
|
assign(:dossier, dossier)
|
||||||
# allow(view) doesn't work because method is called inside partial
|
allow_any_instance_of(ActionView::Base).to receive(:administrateur_signed_in?).and_return(profile == :administrateur)
|
||||||
ActionView::Base.any_instance.stub(:administrateur_signed_in?).and_return(profile == :administrateur)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
subject! { render }
|
subject! { render }
|
||||||
|
|
Loading…
Add table
Reference in a new issue