tests
This commit is contained in:
parent
3817210649
commit
8310dc48bf
2 changed files with 36 additions and 6 deletions
|
@ -532,4 +532,34 @@ describe NewAdministrateur::ProceduresController, type: :controller do
|
|||
it { expect(procedure.allow_expert_review).to be_truthy }
|
||||
end
|
||||
end
|
||||
|
||||
describe 'PUT #update_allow_decision_access' do
|
||||
let!(:procedure) { create :procedure, :with_service, administrateur: admin }
|
||||
let(:expert) { create(:expert) }
|
||||
let(:expert_procedure) { ExpertsProcedure.create(procedure: procedure, expert: expert) }
|
||||
|
||||
subject do
|
||||
put :update_allow_decision_access, params: { procedure_id: procedure.id, experts_procedure: { allow_decision_access: !expert_procedure.allow_decision_access }, expert_procedure: expert_procedure }, format: :js
|
||||
end
|
||||
|
||||
context 'when the experts_procedure is true' do
|
||||
let(:expert_procedure) { ExpertsProcedure.create(procedure: procedure, expert: expert, allow_decision_access: true) }
|
||||
|
||||
before do
|
||||
subject
|
||||
expert_procedure.reload
|
||||
end
|
||||
|
||||
it { expect(expert_procedure.allow_decision_access).to be_falsy }
|
||||
end
|
||||
|
||||
context 'when the experts_procedure is false' do
|
||||
before do
|
||||
subject
|
||||
expert_procedure.reload
|
||||
end
|
||||
|
||||
it { expect(expert_procedure.allow_decision_access).to be_truthy }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -12,13 +12,13 @@ describe 'new_administrateur/procedures/invited_expert_list.html.haml', type: :v
|
|||
context 'when the procedure has 0 avis' do
|
||||
let!(:dossier) { create(:dossier, procedure: procedure) }
|
||||
before do
|
||||
@invited_expert_emails = ExpertsProcedure.invited_expert_emails(procedure)
|
||||
@invited_experts = procedure.experts_procedures
|
||||
subject
|
||||
end
|
||||
|
||||
it 'has 0 experts into the page' do
|
||||
expect(@invited_expert_emails.count).to eq(0)
|
||||
expect(@invited_expert_emails).to eq([])
|
||||
expect(@invited_experts.count).to eq(0)
|
||||
expect(@invited_experts).to eq([])
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -32,13 +32,13 @@ describe 'new_administrateur/procedures/invited_expert_list.html.haml', type: :v
|
|||
let!(:avis2) { create(:avis, dossier: dossier, experts_procedure: experts_procedure2) }
|
||||
|
||||
before do
|
||||
@invited_expert_emails = ExpertsProcedure.invited_expert_emails(procedure)
|
||||
@invited_experts = procedure.experts_procedures
|
||||
subject
|
||||
end
|
||||
|
||||
it 'has 2 experts and match array' do
|
||||
expect(@invited_expert_emails.count).to eq(2)
|
||||
expect(@invited_expert_emails).to eq([expert.email, expert2.email].sort)
|
||||
expect(@invited_experts.count).to eq(2)
|
||||
expect(@invited_experts).to match_array([experts_procedure, experts_procedure2])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue