test: fix deprecated any_instance and stub old syntax

This commit is contained in:
Colin Darie 2023-11-09 17:43:20 +01:00
parent edb47d94f7
commit 610b808d32
No known key found for this signature in database
GPG key ID: 8C76CADD40253590
2 changed files with 3 additions and 4 deletions

View file

@ -53,7 +53,7 @@ RSpec.describe Manager::AdministrateurConfirmationsController, type: :controller
describe 'edge cases' 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
before { sign_in inviter_super_admin }
@ -130,7 +130,7 @@ RSpec.describe Manager::AdministrateurConfirmationsController, type: :controller
describe 'edge cases' 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
before { sign_in inviter_super_admin }

View file

@ -7,8 +7,7 @@ describe 'users/dossiers/brouillon', type: :view do
before do
sign_in dossier.user
assign(:dossier, dossier)
# allow(view) doesn't work because method is called inside partial
ActionView::Base.any_instance.stub(:administrateur_signed_in?).and_return(profile == :administrateur)
allow_any_instance_of(ActionView::Base).to receive(:administrateur_signed_in?).and_return(profile == :administrateur)
end
subject! { render }