test(manager): add basic test on dossiers index & show
This commit is contained in:
parent
bad4581a46
commit
7b9ff5ebe8
1 changed files with 37 additions and 0 deletions
37
spec/controllers/manager/dossiers_controller_spec.rb
Normal file
37
spec/controllers/manager/dossiers_controller_spec.rb
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
include ActionView::Helpers::SanitizeHelper
|
||||||
|
|
||||||
|
describe Manager::DossiersController, type: :controller do
|
||||||
|
let(:super_admin) { create(:super_admin) }
|
||||||
|
before do
|
||||||
|
sign_in super_admin
|
||||||
|
procedure = create(:procedure, :published, types_de_champ_public: types_de_champ)
|
||||||
|
@dossier = create(:dossier, :en_construction, :with_populated_champs, procedure:)
|
||||||
|
end
|
||||||
|
|
||||||
|
let(:types_de_champ) { [] }
|
||||||
|
|
||||||
|
render_views
|
||||||
|
|
||||||
|
describe 'GET #index' do
|
||||||
|
it "should list dossiers" do
|
||||||
|
get :index
|
||||||
|
expect(response.body).to include(@dossier.procedure.libelle)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe "GET #show" do
|
||||||
|
let(:types_de_champ) {
|
||||||
|
[
|
||||||
|
{ libelle: "Nom", mandatory: true }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
before do
|
||||||
|
get :show, params: { id: @dossier.id }
|
||||||
|
end
|
||||||
|
|
||||||
|
subject { strip_tags(response.body) }
|
||||||
|
|
||||||
|
it { expect(subject).to match(%r{Nom\s+\*\s+Texte\s+🟢\s+rempli}) }
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in a new issue