2015-12-04 16:17:35 +01:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe AdminProceduresShowFacades do
|
|
|
|
let!(:procedure) { create(:procedure) }
|
|
|
|
|
2017-12-04 16:17:15 +01:00
|
|
|
let!(:dossier_0) { create(:dossier, procedure: procedure, state: 'brouillon') }
|
2017-12-14 15:51:45 +01:00
|
|
|
let!(:dossier_1) { create(:dossier, procedure: procedure, state: 'en_construction') }
|
|
|
|
let!(:dossier_2) { create(:dossier, procedure: procedure, state: 'en_construction') }
|
|
|
|
let!(:dossier_6) { create(:dossier, procedure: procedure, archived: true, state: 'en_construction') }
|
2015-12-04 16:17:35 +01:00
|
|
|
|
|
|
|
subject { AdminProceduresShowFacades.new procedure }
|
|
|
|
|
|
|
|
describe '.procedure' do
|
|
|
|
subject { super().procedure }
|
|
|
|
|
|
|
|
it { is_expected.to eq(procedure) }
|
|
|
|
end
|
|
|
|
|
|
|
|
describe '.dossiers' do
|
|
|
|
subject { super().dossiers }
|
|
|
|
|
2017-09-22 10:28:16 +02:00
|
|
|
it { expect(subject.size).to eq(3) }
|
2015-12-04 16:17:35 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
describe '.dossiers_for_pie_highchart' do
|
|
|
|
subject { super().dossiers_for_pie_highchart }
|
|
|
|
|
2017-09-22 10:28:16 +02:00
|
|
|
it { expect(subject).to eq({ 'En construction' => 2 }) }
|
2015-12-04 16:17:35 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
describe '.dossiers_archived_by_state_total' do
|
|
|
|
subject { super().dossiers_archived_by_state_total }
|
|
|
|
|
2017-02-23 17:54:11 +01:00
|
|
|
it { expect(subject.size).to eq(1) }
|
2015-12-04 16:17:35 +01:00
|
|
|
|
2017-12-14 15:51:45 +01:00
|
|
|
it { expect(subject.first.state).to eq('en_construction') }
|
2015-12-04 16:17:35 +01:00
|
|
|
it { expect(subject.first.total).to eq(1) }
|
|
|
|
end
|
|
|
|
|
|
|
|
describe 'dossiers_archived_total' do
|
|
|
|
subject { super().dossiers_archived_total }
|
|
|
|
|
2017-02-23 17:54:11 +01:00
|
|
|
it { is_expected.to eq(1) }
|
2015-12-04 16:17:35 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
describe 'dossiers_total' do
|
|
|
|
subject { super().dossiers_total }
|
|
|
|
|
2017-09-22 10:28:16 +02:00
|
|
|
it { is_expected.to eq(3) }
|
2015-12-04 16:17:35 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
describe 'dossiers_termine_total' do
|
|
|
|
subject { super().dossiers_termine_total }
|
|
|
|
|
|
|
|
it { is_expected.to eq(0) }
|
|
|
|
end
|
|
|
|
end
|