fix(spec): broken spec due to TDD and refacto on former code
This commit is contained in:
parent
711b2ee2e4
commit
dc524cf615
7 changed files with 8 additions and 9 deletions
|
@ -15,7 +15,7 @@ class Administrateur < ApplicationRecord
|
|||
UNUSED_ADMIN_THRESHOLD = 6.months
|
||||
|
||||
has_and_belongs_to_many :instructeurs
|
||||
has_many :administrateurs_procedures, dependent: :destroy
|
||||
has_many :administrateurs_procedures
|
||||
has_many :procedures, through: :administrateurs_procedures
|
||||
has_many :services
|
||||
|
||||
|
@ -103,7 +103,7 @@ class Administrateur < ApplicationRecord
|
|||
# We can't destroy a service if it has procedures, even if those procedures are archived
|
||||
service.destroy unless service.procedures.with_discarded.any?
|
||||
end
|
||||
|
||||
AdministrateursProcedure.where(administrateur_id: self.id).delete_all
|
||||
destroy
|
||||
end
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
.container
|
||||
%h1.mb-2
|
||||
Archives
|
||||
- # index not renderable as administrateur flagged as manager, so render it anyway
|
||||
-# index not renderable as administrateur flagged as manager, so render it anyway
|
||||
= render Dossiers::ExportComponent.new(procedure: @procedure, exports: @exports, export_url: method(:download_admin_procedure_exports_path))
|
||||
|
||||
= render partial: "shared/archives/notice"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
- # not renderable as administrateur flagged as manager, so render it anyway
|
||||
-# not renderable as administrateur flagged as manager, so render it anyway
|
||||
- if @can_download_dossiers
|
||||
= turbo_stream.update_all '.procedure-actions' do
|
||||
= render Dossiers::ExportComponent.new(procedure: @procedure, exports: @exports, count: @dossiers_count, export_url: method(:admin_procedure_exports_path))
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
- # not renderable as instructeur flagged as manager, so render it anyway
|
||||
-# not renderable as instructeur flagged as manager, so render it anyway
|
||||
- if @can_download_dossiers
|
||||
- if @statut.nil?
|
||||
= turbo_stream.update_all '.procedure-actions' do
|
||||
|
|
|
@ -499,7 +499,7 @@ describe Instructeurs::ProceduresController, type: :controller do
|
|||
end
|
||||
|
||||
context 'when the export is ready' do
|
||||
let(:export) { create(:export, groupe_instructeurs: [gi_1], job_status: 'generated') }
|
||||
let(:export) { create(:export, groupe_instructeurs: [gi_1, gi_0], job_status: 'generated') }
|
||||
|
||||
before do
|
||||
export.file.attach(io: StringIO.new('export'), filename: 'file.csv')
|
||||
|
@ -512,7 +512,7 @@ describe Instructeurs::ProceduresController, type: :controller do
|
|||
end
|
||||
|
||||
context 'when another export is ready' do
|
||||
let(:export) { create(:export, groupe_instructeurs: [gi_0, gi_1]) }
|
||||
let(:export) { create(:export, groupe_instructeurs: [gi_0]) }
|
||||
|
||||
before do
|
||||
export.file.attach(io: StringIO.new('export'), filename: 'file.csv')
|
||||
|
|
|
@ -3,7 +3,6 @@ describe Administrateur, type: :model do
|
|||
|
||||
describe 'associations' do
|
||||
it { is_expected.to have_and_belong_to_many(:instructeurs) }
|
||||
it { is_expected.to have_and_belong_to_many(:procedures) }
|
||||
end
|
||||
|
||||
describe "#renew_api_token" do
|
||||
|
|
|
@ -14,7 +14,7 @@ describe 'Administrateurs can manage administrateurs', js: true do
|
|||
scenario 'card is clickable' do
|
||||
visit admin_procedure_path(procedure)
|
||||
find('#administrateurs').click
|
||||
expect(page).to have_css("h1", text: "Administrateurs de « #{procedure.libelle} »")
|
||||
expect(page).to have_css("h1", text: "Gérer les administrateurs de « #{procedure.libelle} »")
|
||||
end
|
||||
|
||||
context 'as admin not flagged from manager' do
|
||||
|
|
Loading…
Reference in a new issue