[#887] filter user dossier list

This commit is contained in:
Tanguy PATTE 2015-09-24 11:45:28 +02:00
parent a30eac41fc
commit c1b71b1b54
2 changed files with 4 additions and 2 deletions

View file

@ -1,7 +1,7 @@
class Users::DossiersController < UsersController
before_action :authenticate_user!
def index
@dossiers = Dossier.all.decorate
@dossiers = current_user.dossiers.decorate
end
def show

View file

@ -3,7 +3,8 @@ require 'spec_helper'
feature 'user access to the list of his dossier' do
let(:user) { create(:user) }
let!(:dossier1) { create(:dossier, :with_user) }
let!(:dossier1) { create(:dossier, user: user, nom_projet: 'mon permier dossier') }
let!(:dossier2) { create(:dossier, :with_user, nom_projet: 'mon deuxième dossier') }
before do
visit root_path
page.find_by_id('user_email').set user.email
@ -12,5 +13,6 @@ feature 'user access to the list of his dossier' do
end
scenario 'the list of dossier is displayed' do
expect(page).to have_content(dossier1.nom_projet)
expect(page).not_to have_content(dossier2.nom_projet)
end
end