Tests for display archived dossiers

This commit is contained in:
Mathieu Magnin 2017-03-02 17:52:28 +01:00
parent d03016db9c
commit 0a11165308

View file

@ -3,6 +3,8 @@ require 'spec_helper'
describe Backoffice::Dossiers::ProcedureController, type: :controller do describe Backoffice::Dossiers::ProcedureController, type: :controller do
let(:gestionnaire) { create :gestionnaire } let(:gestionnaire) { create :gestionnaire }
let(:procedure) { create :procedure } let(:procedure) { create :procedure }
let(:archived) { false }
let(:dossier) { create :dossier, procedure: procedure, archived: archived, state: 'initiated'}
before do before do
create :assign_to, gestionnaire: gestionnaire, procedure: procedure create :assign_to, gestionnaire: gestionnaire, procedure: procedure
@ -28,6 +30,24 @@ describe Backoffice::Dossiers::ProcedureController, type: :controller do
it { is_expected.to redirect_to backoffice_dossiers_path } it { is_expected.to redirect_to backoffice_dossiers_path }
it { expect(flash[:alert]).to be_present} it { expect(flash[:alert]).to be_present}
end end
context 'when procedure contains a dossier' do
render_views
before do
dossier
subject
end
it { expect(response.body).to have_content('Tous les dossiers 1 dossier') }
context 'archived' do
let(:archived) { true }
it { expect(response.body).to have_content('Tous les dossiers 0 dossiers') }
it { expect(response.body).to have_content('Dossiers archivés 1 dossier') }
end
end
end end
describe 'GET #filter' do describe 'GET #filter' do