diff --git a/app/controllers/users/dossiers_controller.rb b/app/controllers/users/dossiers_controller.rb index feea68f30..87dbb8d08 100644 --- a/app/controllers/users/dossiers_controller.rb +++ b/app/controllers/users/dossiers_controller.rb @@ -2,7 +2,7 @@ class Users::DossiersController < UsersController before_action :authenticate_user! def index - @dossiers = current_user.dossiers.order(updated_at: 'DESC').decorate + @dossiers = current_user.dossiers.where("state NOT IN ('draft')").order(updated_at: 'DESC').decorate end def show diff --git a/spec/features/users/list_dossiers_spec.rb b/spec/features/users/list_dossiers_spec.rb index cb9586917..e989e70a7 100644 --- a/spec/features/users/list_dossiers_spec.rb +++ b/spec/features/users/list_dossiers_spec.rb @@ -3,9 +3,10 @@ require 'spec_helper' feature 'user access to the list of his dossier' do let(:user) { create(:user) } - let!(:last_updated_dossier) { create(:dossier, :with_procedure, user: user)} - let!(:dossier1) { create(:dossier, :with_procedure, user: user, nom_projet: 'mon permier dossier') } + let!(:last_updated_dossier) { create(:dossier, :with_procedure, user: user, state: 'initiated')} + let!(:dossier1) { create(:dossier, :with_procedure, user: user, nom_projet: 'mon permier dossier', state: 'initiated') } let!(:dossier2) { create(:dossier, :with_user, nom_projet: 'mon deuxième dossier') } + before do last_updated_dossier.update_attributes(nom_projet: 'salut la compagnie') visit root_path