demarches-normaliennes/spec/views/backoffice/dossiers/index_html.haml_spec.rb

88 lines
3.3 KiB
Ruby
Raw Normal View History

require 'spec_helper'
describe 'backoffice/dossiers/index.html.haml', type: :view do
let(:administrateur) { create(:administrateur) }
let(:gestionnaire) { create(:gestionnaire, administrateurs: [administrateur]) }
let!(:procedure) { create(:procedure, :published, administrateur: administrateur) }
let!(:decorate_dossier_en_construction) { create(:dossier, :with_entreprise, procedure: procedure, state: 'en_construction').decorate }
let!(:decorate_dossier_en_instruction) { create(:dossier, :with_entreprise, procedure: procedure, state: 'en_instruction').decorate }
2017-12-04 18:00:12 +01:00
let!(:decorate_dossier_accepte) { create(:dossier, :with_entreprise, procedure: procedure, state: 'accepte').decorate }
2017-12-04 18:15:40 +01:00
let!(:decorate_dossier_refuse) { create(:dossier, :with_entreprise, procedure: procedure, state: 'refuse').decorate }
let!(:decorate_dossier_sans_suite) { create(:dossier, :with_entreprise, procedure: procedure, state: 'sans_suite').decorate }
2016-12-01 18:05:49 +01:00
let(:dossiers_list_facade) { DossiersListFacades.new gestionnaire, nil }
let(:new_dossiers_list) { dossiers_list_facade.service.nouveaux }
let(:follow_dossiers_list) { dossiers_list_facade.service.suivi }
let(:all_state_dossiers_list) { dossiers_list_facade.service.all_state }
before do
decorate_dossier_en_instruction.entreprise.update_column(:raison_sociale, 'plup')
2017-12-04 18:00:12 +01:00
decorate_dossier_accepte.entreprise.update_column(:raison_sociale, 'plyp')
2017-12-04 18:15:40 +01:00
decorate_dossier_refuse.entreprise.update_column(:raison_sociale, 'plzp')
decorate_dossier_sans_suite.entreprise.update_column(:raison_sociale, 'plnp')
create :preference_list_dossier,
2017-06-12 13:49:51 +02:00
gestionnaire: gestionnaire,
table: nil,
attr: 'state',
attr_decorate: 'display_state'
create :preference_list_dossier,
2017-06-12 13:49:51 +02:00
gestionnaire: gestionnaire,
table: 'procedure',
attr: 'libelle',
attr_decorate: 'libelle'
create :preference_list_dossier,
2017-06-12 13:49:51 +02:00
gestionnaire: gestionnaire,
table: 'entreprise',
attr: 'raison_sociale',
attr_decorate: 'raison_sociale'
create :preference_list_dossier,
2017-06-12 13:49:51 +02:00
gestionnaire: gestionnaire,
table: nil,
attr: 'last_update',
attr_decorate: 'last_update'
create :assign_to, gestionnaire: gestionnaire, procedure: procedure
sign_in gestionnaire
2016-12-01 18:05:49 +01:00
assign :facade_data_view, dossiers_list_facade
2016-12-01 18:05:49 +01:00
assign(:new_dossiers, (smart_listing_create :new_dossiers,
2017-06-12 13:49:51 +02:00
new_dossiers_list,
partial: "backoffice/dossiers/list",
array: true))
2016-12-01 18:05:49 +01:00
assign(:follow_dossiers, (smart_listing_create :follow_dossiers,
2017-06-12 13:49:51 +02:00
follow_dossiers_list,
partial: "backoffice/dossiers/list",
array: true))
2016-12-01 18:05:49 +01:00
assign(:all_state_dossiers, (smart_listing_create :all_state_dossiers,
2017-06-12 13:49:51 +02:00
all_state_dossiers_list,
partial: "backoffice/dossiers/list",
array: true))
2016-12-01 18:05:49 +01:00
render
end
2016-07-19 17:18:41 +02:00
2016-12-01 18:05:49 +01:00
subject { rendered }
2016-07-19 17:18:41 +02:00
2017-02-28 11:37:37 +01:00
it { is_expected.to have_content('Nouveaux dossiers 1 dossier') }
2016-12-01 18:05:49 +01:00
it { is_expected.to have_content('Dossiers suivis 0 dossiers') }
2017-09-22 10:28:16 +02:00
it { is_expected.to have_content('Tous les dossiers 5 dossiers') }
2016-07-19 17:18:41 +02:00
2016-12-01 18:05:49 +01:00
it { is_expected.to have_content('État') }
it { is_expected.to have_content('Libellé procédure') }
it { is_expected.to have_content('Raison sociale') }
it { is_expected.to have_content('Mise à jour le') }
2016-07-19 17:18:41 +02:00
2016-12-01 18:05:49 +01:00
it { is_expected.to have_content('plup') }
it { is_expected.to have_content('plyp') }
2017-04-04 15:27:04 +02:00
end