Merge pull request #10014 from mfo/US/better-expert-exports
ETQ expert: je retrouve mes avis confidentiel dans les exports. ETQ instructeur, je retrouve les fichiers joint a une demande d'avis expert
This commit is contained in:
commit
41a27fbad2
2 changed files with 44 additions and 12 deletions
|
@ -224,26 +224,36 @@ describe PiecesJustificativesService do
|
|||
}
|
||||
|
||||
avis.piece_justificative_file.attach(to_be_attached)
|
||||
avis.introduction_file.attach(avis.piece_justificative_file.blob)
|
||||
end
|
||||
|
||||
context 'given an administrateur' do
|
||||
let(:user_profile) { build(:administrateur) }
|
||||
it "doesn't return confidentiel avis.piece_justificative_file" do
|
||||
expect(subject).not_to be_empty
|
||||
expect(subject.size).to eq(2)
|
||||
end
|
||||
end
|
||||
|
||||
context 'given an instructeur' do
|
||||
let(:user_profile) { create(:instructeur) }
|
||||
it "doesn't return confidentiel avis.piece_justificative_file" do
|
||||
expect(subject).not_to be_empty
|
||||
expect(subject.size).to eq(2)
|
||||
end
|
||||
end
|
||||
|
||||
context 'given an expert' do
|
||||
let(:user_profile) { create(:expert) }
|
||||
it "doesn't return confidentiel avis.piece_justificative_file" do
|
||||
expect(subject).to be_empty
|
||||
expect(subject.size).to eq(0)
|
||||
end
|
||||
end
|
||||
|
||||
context 'when the expert has given the avis' do
|
||||
let(:experts_procedure) { create(:experts_procedure, expert: user_profile, procedure:) }
|
||||
let(:avis) { create(:avis, experts_procedure:, dossier: dossier, confidentiel: true) }
|
||||
let(:user_profile) { create(:expert) }
|
||||
it "doesn't return confidentiel avis.piece_justificative_file" do
|
||||
expect(subject.size).to eq(2)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -251,7 +261,7 @@ describe PiecesJustificativesService do
|
|||
context 'with avis.piece_justificative being public' do
|
||||
let(:procedure) { create(:procedure) }
|
||||
let(:dossier) { create(:dossier, procedure: procedure) }
|
||||
let(:avis) { create(:avis, dossier: dossier) }
|
||||
let(:avis) { create(:avis, dossier: dossier, confidentiel: false) }
|
||||
before do
|
||||
to_be_attached = {
|
||||
io: StringIO.new("toto"),
|
||||
|
@ -261,26 +271,27 @@ describe PiecesJustificativesService do
|
|||
}
|
||||
|
||||
avis.piece_justificative_file.attach(to_be_attached)
|
||||
avis.introduction_file.attach(avis.piece_justificative_file.blob)
|
||||
end
|
||||
|
||||
context 'given an administrateur' do
|
||||
let(:user_profile) { build(:administrateur) }
|
||||
it "doesn't return confidentiel avis.piece_justificative_file" do
|
||||
expect(subject).not_to be_empty
|
||||
expect(subject.size).to eq(2)
|
||||
end
|
||||
end
|
||||
|
||||
context 'given an instructeur' do
|
||||
let(:user_profile) { create(:instructeur) }
|
||||
it "doesn't return confidentiel avis.piece_justificative_file" do
|
||||
expect(subject).not_to be_empty
|
||||
expect(subject.size).to eq(2)
|
||||
end
|
||||
end
|
||||
|
||||
context 'given an expert' do
|
||||
let(:user_profile) { create(:expert) }
|
||||
it "doesn't return confidentiel avis.piece_justificative_file" do
|
||||
expect(subject).not_to be_empty
|
||||
expect(subject.size).to eq(2)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue