Merge branch 'develop' into staging

This commit is contained in:
Xavier J 2016-05-25 14:08:11 +02:00
commit 666905c8af
3 changed files with 0 additions and 55 deletions

View file

@ -84,18 +84,6 @@ class Users::DossiersController < UsersController
end end
end end
def archive
dossier = current_user.dossiers.find(params[:dossier_id])
dossier.update_attributes({archived: true})
flash.notice = 'Dossier archivé'
redirect_to users_dossiers_path
rescue ActiveRecord::RecordNotFound
flash.alert = 'Dossier inéxistant'
redirect_to users_dossiers_path
end
def self.route_authorization def self.route_authorization
{ {
states: [:draft] states: [:draft]

View file

@ -3,19 +3,6 @@
.row .row
.col-md-6.col-lg-6 .col-md-6.col-lg-6
%h2 Récapitulatif %h2 Récapitulatif
.col-md-6.col-lg-6
- if current_user.email == @facade.dossier.user.email
= form_tag "/users/dossiers/#{@facade.dossier.id}/archive", style:'margin-top:21px', action: :archive, method: :put do
%button#archive.btn.btn-sm.btn-default.text-info{type: :button}
%i.fa.fa-eraser
Archiver
#confirm
%button#cancel.btn.btn-sm.btn-danger{type: :button}
%i.fa.fa-remove
Annuler
%button#valid.btn.btn-sm.btn-success{type: :submit}
%i.fa.fa-check
Valider
.col-md-5.col-lg-5 .col-md-5.col-lg-5

View file

@ -288,36 +288,6 @@ describe Users::DossiersController, type: :controller do
end end
end end
describe 'PUT #archive' do
let(:dossier) { create(:dossier, user: user) }
context 'when user is the owner of the file' do
before do
sign_in user
put :archive, dossier_id: dossier.id
dossier.reload
end
it { expect(dossier.archived).to be_truthy }
it { expect(response).to redirect_to :users_dossiers }
it { expect(flash[:notice]).to have_content 'Dossier archivé' }
end
context 'when user is not the owner of the file' do
let(:user_2) { create(:user) }
before do
sign_in user_2
put :archive, dossier_id: dossier.id
procedure.reload
end
it { expect(response).to redirect_to :users_dossiers }
it { expect(flash[:alert]).to have_content 'Dossier inéxistant' }
end
end
describe 'GET #a_traiter' do describe 'GET #a_traiter' do
context 'when user is connected' do context 'when user is connected' do
before do before do