From ef1d46d30e6311ac537486785f00b854605d1563 Mon Sep 17 00:00:00 2001 From: Mathieu Magnin Date: Tue, 28 Feb 2017 11:37:37 +0100 Subject: [PATCH] Fix tests --- .../backoffice/dossiers_list_controller.rb | 3 ++- app/views/backoffice/dossiers/index.html.haml | 23 ++++++++++--------- .../backoffice/dossiers_controller_spec.rb | 6 ----- .../dossiers/index_html.haml_spec.rb | 2 +- 4 files changed, 15 insertions(+), 19 deletions(-) diff --git a/app/controllers/backoffice/dossiers_list_controller.rb b/app/controllers/backoffice/dossiers_list_controller.rb index 632c2c750..09575f43c 100644 --- a/app/controllers/backoffice/dossiers_list_controller.rb +++ b/app/controllers/backoffice/dossiers_list_controller.rb @@ -57,7 +57,8 @@ class Backoffice::DossiersListController < ApplicationController default_sort: dossiers_list_facade.service.default_sort - @procedure = current_gestionnaire.procedures.find(params[:id]) + procedure_id = params[:id] || params[:procedure_id] + @procedure = current_gestionnaire.procedures.find(procedure_id) @dossiers_archived = @procedure.dossiers.archived smart_listing_create :dossiers_archived, @dossiers_archived, diff --git a/app/views/backoffice/dossiers/index.html.haml b/app/views/backoffice/dossiers/index.html.haml index def2b8722..38f0cf915 100644 --- a/app/views/backoffice/dossiers/index.html.haml +++ b/app/views/backoffice/dossiers/index.html.haml @@ -51,15 +51,16 @@ = smart_listing_render :all_state_dossiers - .default_data_block - %div.row.show-block#all_dossiers - %div.header - %div.col-xs-10.title - %div.carret-right - %div.carret-down - Dossiers archivés - %div.col-xs-2.count - = pluralize(@dossiers_archived.count, "dossier") + - if @dossiers_archived + .default_data_block + %div.row.show-block#archived_dossiers + %div.header + %div.col-xs-10.title + %div.carret-right + %div.carret-down + Dossiers archivés + %div.col-xs-2.count + = pluralize(@dossiers_archived.count, "dossier") - %div.body - = smart_listing_render :dossiers_archived + %div.body + = smart_listing_render :dossiers_archived diff --git a/spec/controllers/backoffice/dossiers_controller_spec.rb b/spec/controllers/backoffice/dossiers_controller_spec.rb index 89153cfaf..938ad037f 100644 --- a/spec/controllers/backoffice/dossiers_controller_spec.rb +++ b/spec/controllers/backoffice/dossiers_controller_spec.rb @@ -104,12 +104,6 @@ describe Backoffice::DossiersController, type: :controller do end end - context ' when dossier is archived' do - let(:dossier_id) { dossier_archived } - - it { expect(subject).to redirect_to('/backoffice') } - end - context 'when dossier id does not exist' do let(:dossier_id) { bad_dossier_id } diff --git a/spec/views/backoffice/dossiers/index_html.haml_spec.rb b/spec/views/backoffice/dossiers/index_html.haml_spec.rb index 84a3eef1f..212fc05b2 100644 --- a/spec/views/backoffice/dossiers/index_html.haml_spec.rb +++ b/spec/views/backoffice/dossiers/index_html.haml_spec.rb @@ -81,7 +81,7 @@ describe 'backoffice/dossiers/index.html.haml', type: :view do subject { rendered } - it { is_expected.to have_content('Nouveaux dossiers 1 dossiers') } + it { is_expected.to have_content('Nouveaux dossiers 1 dossier') } it { is_expected.to have_content('Dossiers suivis 0 dossiers') } it { is_expected.to have_content('Tous les dossiers 9 dossiers') }