2015-12-02 18:03:52 +01:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe 'backoffice/dossiers/index.html.haml', type: :view do
|
|
|
|
let(:administrateur) { create(:administrateur) }
|
2016-05-20 15:39:17 +02:00
|
|
|
let(:gestionnaire) { create(:gestionnaire, administrateurs: [administrateur]) }
|
2015-12-02 18:03:52 +01:00
|
|
|
|
|
|
|
let!(:procedure) { create(:procedure, administrateur: administrateur) }
|
2016-03-14 16:49:12 +01:00
|
|
|
|
2016-07-19 16:10:50 +02:00
|
|
|
let!(:decorate_dossier_initiated) { create(:dossier, :with_entreprise, procedure: procedure, state: 'initiated').decorate }
|
|
|
|
let!(:decorate_dossier_replied) { create(:dossier, :with_entreprise, procedure: procedure, state: 'replied').decorate }
|
|
|
|
let!(:decorate_dossier_closed) { create(:dossier, :with_entreprise, procedure: procedure, state: 'closed').decorate }
|
2015-12-02 18:03:52 +01:00
|
|
|
|
2016-05-20 15:39:17 +02:00
|
|
|
before do
|
2016-07-19 16:10:50 +02:00
|
|
|
|
|
|
|
decorate_dossier_closed.entreprise.update_column(:raison_sociale, 'plip')
|
|
|
|
decorate_dossier_replied.entreprise.update_column(:raison_sociale, 'plop')
|
|
|
|
|
2016-05-20 15:39:17 +02:00
|
|
|
create :assign_to, gestionnaire: gestionnaire, procedure: procedure
|
2016-07-19 16:10:50 +02:00
|
|
|
sign_in gestionnaire
|
2016-05-20 15:39:17 +02:00
|
|
|
end
|
|
|
|
|
2015-12-02 18:03:52 +01:00
|
|
|
describe 'on tab a_traiter' do
|
|
|
|
before do
|
2016-01-11 14:10:41 +01:00
|
|
|
assign(:dossiers, (smart_listing_create :dossiers,
|
|
|
|
gestionnaire.dossiers.waiting_for_gestionnaire,
|
|
|
|
partial: "backoffice/dossiers/list",
|
|
|
|
array: true))
|
2015-12-02 18:03:52 +01:00
|
|
|
assign(:liste, 'a_traiter')
|
2015-12-24 15:10:20 +01:00
|
|
|
assign(:a_traiter_class, 'active')
|
|
|
|
|
2015-12-02 18:03:52 +01:00
|
|
|
render
|
|
|
|
end
|
|
|
|
|
|
|
|
subject { rendered }
|
|
|
|
it { is_expected.to have_css('#backoffice_index') }
|
|
|
|
it { is_expected.to have_content(procedure.libelle) }
|
2016-07-19 16:10:50 +02:00
|
|
|
it { is_expected.to have_content(decorate_dossier_initiated.entreprise.raison_sociale) }
|
2015-12-24 16:12:16 +01:00
|
|
|
it { is_expected.to have_content(decorate_dossier_initiated.display_state) }
|
2015-12-02 18:03:52 +01:00
|
|
|
it { is_expected.to have_content(decorate_dossier_initiated.last_update) }
|
|
|
|
|
2016-07-19 16:10:50 +02:00
|
|
|
it { is_expected.not_to have_content(decorate_dossier_replied.entreprise.raison_sociale) }
|
|
|
|
it { is_expected.not_to have_content(decorate_dossier_closed.entreprise.raison_sociale) }
|
2015-12-02 18:03:52 +01:00
|
|
|
|
2016-07-18 18:24:29 +02:00
|
|
|
it { is_expected.to have_css("#suivre_dossier_#{gestionnaire.dossiers.waiting_for_gestionnaire.first.id}") }
|
|
|
|
|
2015-12-02 18:03:52 +01:00
|
|
|
describe 'active tab' do
|
|
|
|
it { is_expected.to have_selector('.active .text-danger') }
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
describe 'on tab en_attente' do
|
|
|
|
before do
|
2016-01-11 14:10:41 +01:00
|
|
|
assign(:dossiers, (smart_listing_create :dossiers,
|
|
|
|
gestionnaire.dossiers.waiting_for_user,
|
|
|
|
partial: "backoffice/dossiers/list",
|
|
|
|
array: true))
|
2015-12-02 18:03:52 +01:00
|
|
|
assign(:liste, 'en_attente')
|
2015-12-24 15:10:20 +01:00
|
|
|
assign(:en_attente_class, 'active')
|
|
|
|
|
2015-12-02 18:03:52 +01:00
|
|
|
render
|
|
|
|
end
|
|
|
|
|
|
|
|
subject { rendered }
|
|
|
|
it { is_expected.to have_css('#backoffice_index') }
|
|
|
|
it { is_expected.to have_content(procedure.libelle) }
|
2016-07-19 16:10:50 +02:00
|
|
|
it { is_expected.to have_content(decorate_dossier_replied.entreprise.raison_sociale) }
|
2015-12-24 16:12:16 +01:00
|
|
|
it { is_expected.to have_content(decorate_dossier_replied.display_state) }
|
2015-12-02 18:03:52 +01:00
|
|
|
it { is_expected.to have_content(decorate_dossier_replied.last_update) }
|
|
|
|
|
2016-07-19 16:10:50 +02:00
|
|
|
it { is_expected.not_to have_content(decorate_dossier_initiated.entreprise.raison_sociale) }
|
|
|
|
it { is_expected.not_to have_content(decorate_dossier_closed.entreprise.raison_sociale) }
|
2015-12-02 18:03:52 +01:00
|
|
|
|
|
|
|
describe 'active tab' do
|
|
|
|
it { is_expected.to have_selector('.active .text-info') }
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
describe 'on tab termine' do
|
|
|
|
before do
|
2016-01-11 14:10:41 +01:00
|
|
|
assign(:dossiers, (smart_listing_create :dossiers,
|
|
|
|
gestionnaire.dossiers.termine,
|
|
|
|
partial: "backoffice/dossiers/list",
|
|
|
|
array: true))
|
2015-12-24 15:10:20 +01:00
|
|
|
assign(:termine_class, 'active')
|
2015-12-02 18:03:52 +01:00
|
|
|
assign(:liste, 'termine')
|
|
|
|
render
|
|
|
|
end
|
|
|
|
|
|
|
|
subject { rendered }
|
2016-01-11 14:10:41 +01:00
|
|
|
|
2015-12-02 18:03:52 +01:00
|
|
|
it { is_expected.to have_css('#backoffice_index') }
|
|
|
|
it { is_expected.to have_content(procedure.libelle) }
|
2016-07-19 16:10:50 +02:00
|
|
|
it { is_expected.to have_content(decorate_dossier_closed.entreprise.raison_sociale) }
|
2015-12-24 16:12:16 +01:00
|
|
|
it { is_expected.to have_content(decorate_dossier_closed.display_state) }
|
2015-12-02 18:03:52 +01:00
|
|
|
it { is_expected.to have_content(decorate_dossier_closed.last_update) }
|
|
|
|
|
2016-07-19 16:10:50 +02:00
|
|
|
it { is_expected.not_to have_content(decorate_dossier_initiated.entreprise.raison_sociale) }
|
|
|
|
it { is_expected.not_to have_content(decorate_dossier_replied.entreprise.raison_sociale) }
|
2015-12-02 18:03:52 +01:00
|
|
|
|
2016-07-18 18:24:29 +02:00
|
|
|
it { is_expected.not_to have_css("#suivre_dossier_#{gestionnaire.dossiers.termine.first.id}") }
|
|
|
|
|
2015-12-02 18:03:52 +01:00
|
|
|
describe 'active tab' do
|
|
|
|
it { is_expected.to have_selector('.active .text-success') }
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|