- Code review
- Delete routes 'users/dossiers/a_traiter - en_attente - termine' for user - Add routes 'uses/dossiers/?liste=xxx' to reach at file lists for user
This commit is contained in:
parent
0478805501
commit
5cebb5b621
16 changed files with 228 additions and 230 deletions
|
@ -2,12 +2,12 @@ class Admin::ProceduresController < AdminController
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@procedures = current_administrateur.procedures.where(archived: false)
|
@procedures = current_administrateur.procedures.where(archived: false)
|
||||||
@procedures = @procedures.paginate(:page => params[:page])
|
.paginate(:page => params[:page])
|
||||||
end
|
end
|
||||||
|
|
||||||
def archived
|
def archived
|
||||||
@procedures_archived = current_administrateur.procedures.where(archived: true)
|
@procedures_archived = current_administrateur.procedures.where(archived: true)
|
||||||
@procedures_archived = @procedures_archived.paginate(:page => params[:page])
|
.paginate(:page => params[:page])
|
||||||
end
|
end
|
||||||
|
|
||||||
def show
|
def show
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
class DemoController < ApplicationController
|
class DemoController < ApplicationController
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@procedures = Procedure.all.where(archived: false).order('libelle ASC')
|
@procedures = Procedure.where(archived: false).order('libelle ASC')
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,14 +2,37 @@ class Users::DossiersController < UsersController
|
||||||
before_action :authenticate_user!
|
before_action :authenticate_user!
|
||||||
|
|
||||||
def index
|
def index
|
||||||
redirect_to users_dossiers_a_traiter_path
|
order = 'DESC'
|
||||||
|
|
||||||
|
if params[:liste] == 'a_traiter' || params[:liste].nil?
|
||||||
|
@dossiers = current_user.dossiers.waiting_for_user order
|
||||||
|
@dossiers_a_traiter = @dossiers
|
||||||
|
|
||||||
|
@liste = 'a_traiter'
|
||||||
|
|
||||||
|
elsif params[:liste] == 'en_attente'
|
||||||
|
@dossiers = current_user.dossiers.waiting_for_gestionnaire order
|
||||||
|
@dossiers_en_attente = @dossiers
|
||||||
|
|
||||||
|
@liste = 'en_attente'
|
||||||
|
|
||||||
|
elsif params[:liste] == 'termine'
|
||||||
|
|
||||||
|
@dossiers = current_user.dossiers.termine order
|
||||||
|
@dossiers_termine = @dossiers
|
||||||
|
|
||||||
|
@liste = 'termine'
|
||||||
|
end
|
||||||
|
|
||||||
|
@dossiers = @dossiers.paginate(:page => (params[:page] || 1)).decorate
|
||||||
|
total_dossiers_per_state
|
||||||
end
|
end
|
||||||
|
|
||||||
def show
|
def show
|
||||||
@dossier = current_user_dossier params[:id]
|
@dossier = current_user_dossier params[:id]
|
||||||
|
|
||||||
@etablissement = @dossier.etablissement
|
@etablissement = @dossier.etablissement
|
||||||
@entreprise = @dossier.entreprise.decorate
|
@entreprise = @dossier.entreprise.decorate
|
||||||
rescue ActiveRecord::RecordNotFound
|
rescue ActiveRecord::RecordNotFound
|
||||||
flash.alert = t('errors.messages.dossier_not_found')
|
flash.alert = t('errors.messages.dossier_not_found')
|
||||||
redirect_to url_for(controller: :siret)
|
redirect_to url_for(controller: :siret)
|
||||||
|
@ -60,8 +83,8 @@ class Users::DossiersController < UsersController
|
||||||
redirect_to url_for(controller: :description, action: :show, dossier_id: @dossier.id)
|
redirect_to url_for(controller: :description, action: :show, dossier_id: @dossier.id)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
@etablissement = @dossier.etablissement
|
@etablissement = @dossier.etablissement
|
||||||
@entreprise = @dossier.entreprise.decorate
|
@entreprise = @dossier.entreprise.decorate
|
||||||
flash.now.alert = 'Les conditions sont obligatoires.'
|
flash.now.alert = 'Les conditions sont obligatoires.'
|
||||||
render 'show'
|
render 'show'
|
||||||
end
|
end
|
||||||
|
@ -79,36 +102,6 @@ class Users::DossiersController < UsersController
|
||||||
redirect_to users_dossiers_path
|
redirect_to users_dossiers_path
|
||||||
end
|
end
|
||||||
|
|
||||||
def a_traiter
|
|
||||||
@dossiers_a_traiter = current_user.dossiers.waiting_for_user 'DESC'
|
|
||||||
@dossiers = @dossiers_a_traiter
|
|
||||||
|
|
||||||
params[:page] = 1 if params[:page].nil?
|
|
||||||
|
|
||||||
@dossiers = @dossiers.paginate(:page => params[:page]).decorate
|
|
||||||
total_dossiers_per_state
|
|
||||||
end
|
|
||||||
|
|
||||||
def en_attente
|
|
||||||
@dossiers_en_attente = current_user.dossiers.waiting_for_gestionnaire 'DESC'
|
|
||||||
@dossiers = @dossiers_en_attente
|
|
||||||
|
|
||||||
params[:page] = 1 if params[:page].nil?
|
|
||||||
|
|
||||||
@dossiers = @dossiers.paginate(:page => params[:page]).decorate
|
|
||||||
total_dossiers_per_state
|
|
||||||
end
|
|
||||||
|
|
||||||
def termine
|
|
||||||
@dossiers_termine = current_user.dossiers.termine 'DESC'
|
|
||||||
@dossiers = @dossiers_termine
|
|
||||||
|
|
||||||
params[:page] = 1 if params[:page].nil?
|
|
||||||
|
|
||||||
@dossiers = @dossiers.paginate(:page => params[:page]).decorate
|
|
||||||
total_dossiers_per_state
|
|
||||||
end
|
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def update_params
|
def update_params
|
||||||
|
|
|
@ -3,22 +3,24 @@
|
||||||
|
|
||||||
#onglets
|
#onglets
|
||||||
%ul.nav.nav-tabs
|
%ul.nav.nav-tabs
|
||||||
%li{class: "#{'active' unless @dossiers_a_traiter.nil? }"}
|
%li{ class: (@dossiers.active_class_a_traiter(@liste) unless @dossiers.nil?) }
|
||||||
%a{:href => "#{url_for :users_dossiers_a_traiter}"}
|
%a{:href => "#{url_for users_dossiers_path(liste: 'a_traiter')}"}
|
||||||
%h5.text-danger
|
%h5.text-danger
|
||||||
= "À traiter "
|
= "À traiter "
|
||||||
.badge.progress-bar-danger
|
.badge.progress-bar-danger
|
||||||
= @dossiers_a_traiter_total
|
= @dossiers_a_traiter_total
|
||||||
%li{class: "#{'active' unless @dossiers_en_attente.nil? }"}
|
|
||||||
%a{:href => "#{url_for :users_dossiers_en_attente}"}
|
%li{ class: (@dossiers.active_class_en_attente(@liste) unless @dossiers.nil?) }
|
||||||
|
%a{:href => "#{url_for users_dossiers_path(liste: 'en_attente')}"}
|
||||||
%h5.text-info
|
%h5.text-info
|
||||||
="En attente "
|
="En attente "
|
||||||
.badge.progress-bar-info
|
.badge.progress-bar-info
|
||||||
= @dossiers_en_attente_total
|
= @dossiers_en_attente_total
|
||||||
%li{class: "#{'active' unless @dossiers_termine.nil? }"}
|
|
||||||
%a{:href => "#{url_for :users_dossiers_termine}"}
|
%li{ class: (@dossiers.active_class_termine(@liste) unless @dossiers.nil?) }
|
||||||
|
%a{:href => "#{url_for users_dossiers_path(liste: 'termine')}"}
|
||||||
%h5.text-success
|
%h5.text-success
|
||||||
= "Terminé"
|
= "Terminé"
|
||||||
.badge.progress-bar-success
|
.badge.progress-bar-success
|
||||||
= @dossiers_termine_total
|
= @dossiers_termine_total
|
||||||
%br
|
%br
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
#users_a_traiter
|
|
||||||
= render partial: 'onglets'
|
|
||||||
|
|
||||||
= render partial: 'list'
|
|
|
@ -1,4 +0,0 @@
|
||||||
#users_en_attente
|
|
||||||
= render partial: 'onglets'
|
|
||||||
|
|
||||||
= render partial: 'list'
|
|
|
@ -1,4 +1,4 @@
|
||||||
#users_termine
|
#users_index
|
||||||
= render partial: 'onglets'
|
= render partial: 'onglets'
|
||||||
|
|
||||||
= render partial: 'list'
|
= render partial: 'list'
|
|
@ -24,12 +24,7 @@ Rails.application.routes.draw do
|
||||||
get 'siret' => 'siret#index'
|
get 'siret' => 'siret#index'
|
||||||
get 'procedure/:procedure_id' => 'procedure#index'
|
get 'procedure/:procedure_id' => 'procedure#index'
|
||||||
|
|
||||||
get 'dossiers/a_traiter' => 'dossiers#a_traiter'
|
|
||||||
get 'dossiers/en_attente' => 'dossiers#en_attente'
|
|
||||||
get 'dossiers/termine' => 'dossiers#termine'
|
|
||||||
|
|
||||||
resources :dossiers do
|
resources :dossiers do
|
||||||
|
|
||||||
get '/description' => 'description#show'
|
get '/description' => 'description#show'
|
||||||
get '/description/error' => 'description#error'
|
get '/description/error' => 'description#error'
|
||||||
post 'description' => 'description#create'
|
post 'description' => 'description#create'
|
||||||
|
@ -87,58 +82,58 @@ Rails.application.routes.draw do
|
||||||
resources :commentaires, only: [:create]
|
resources :commentaires, only: [:create]
|
||||||
end
|
end
|
||||||
|
|
||||||
# The priority is based upon order of creation: first created -> highest priority.
|
# The priority is based upon order of creation: first created -> highest priority.
|
||||||
# See how all your routes lay out with "rake routes".
|
# See how all your routes lay out with "rake routes".
|
||||||
|
|
||||||
# You can have the root of your site routed with "root"
|
# You can have the root of your site routed with "root"
|
||||||
# root 'welcome#index'
|
# root 'welcome#index'
|
||||||
|
|
||||||
# Example of regular route:
|
# Example of regular route:
|
||||||
# get 'products/:id' => 'catalog#view'
|
# get 'products/:id' => 'catalog#view'
|
||||||
|
|
||||||
# Example of named route that can be invoked with purchase_url(id: product.id)
|
# Example of named route that can be invoked with purchase_url(id: product.id)
|
||||||
# get 'products/:id/purchase' => 'catalog#purchase', as: :purchase
|
# get 'products/:id/purchase' => 'catalog#purchase', as: :purchase
|
||||||
|
|
||||||
# Example resource route (maps HTTP verbs to controller actions automatically):
|
# Example resource route (maps HTTP verbs to controller actions automatically):
|
||||||
# resources :products
|
# resources :products
|
||||||
|
|
||||||
# Example resource route with options:
|
# Example resource route with options:
|
||||||
# resources :products do
|
# resources :products do
|
||||||
# member do
|
# member do
|
||||||
# get 'short'
|
# get 'short'
|
||||||
# post 'toggle'
|
# post 'toggle'
|
||||||
# end
|
# end
|
||||||
#
|
#
|
||||||
# collection do
|
# collection do
|
||||||
# get 'sold'
|
# get 'sold'
|
||||||
# end
|
# end
|
||||||
# end
|
# end
|
||||||
|
|
||||||
# Example resource route with sub-resources:
|
# Example resource route with sub-resources:
|
||||||
# resources :products do
|
# resources :products do
|
||||||
# resources :comments, :sales
|
# resources :comments, :sales
|
||||||
# resource :seller
|
# resource :seller
|
||||||
# end
|
# end
|
||||||
|
|
||||||
# Example resource route with more complex sub-resources:
|
# Example resource route with more complex sub-resources:
|
||||||
# resources :products do
|
# resources :products do
|
||||||
# resources :comments
|
# resources :comments
|
||||||
# resources :sales do
|
# resources :sales do
|
||||||
# get 'recent', on: :collection
|
# get 'recent', on: :collection
|
||||||
# end
|
# end
|
||||||
# end
|
# end
|
||||||
|
|
||||||
# Example resource route with concerns:
|
# Example resource route with concerns:
|
||||||
# concern :toggleable do
|
# concern :toggleable do
|
||||||
# post 'toggle'
|
# post 'toggle'
|
||||||
# end
|
# end
|
||||||
# resources :posts, concerns: :toggleable
|
# resources :posts, concerns: :toggleable
|
||||||
# resources :photos, concerns: :toggleable
|
# resources :photos, concerns: :toggleable
|
||||||
|
|
||||||
# Example resource route within a namespace:
|
# Example resource route within a namespace:
|
||||||
# namespace :admin do
|
# namespace :admin do
|
||||||
# # Directs /admin/products/* to Admin::ProductsController
|
# # Directs /admin/products/* to Admin::ProductsController
|
||||||
# # (app/controllers/admin/products_controller.rb)
|
# # (app/controllers/admin/products_controller.rb)
|
||||||
# resources :products
|
# resources :products
|
||||||
# end
|
# end
|
||||||
end
|
end
|
||||||
|
|
|
@ -14,12 +14,12 @@ describe Admin::ProceduresController, type: :controller do
|
||||||
|
|
||||||
let(:procedure_params) {
|
let(:procedure_params) {
|
||||||
{
|
{
|
||||||
libelle: libelle,
|
libelle: libelle,
|
||||||
description: description,
|
description: description,
|
||||||
organisation: organisation,
|
organisation: organisation,
|
||||||
direction: direction,
|
direction: direction,
|
||||||
lien_demarche: lien_demarche,
|
lien_demarche: lien_demarche,
|
||||||
use_api_carto: use_api_carto
|
use_api_carto: use_api_carto
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,7 +94,7 @@ describe Admin::ProceduresController, type: :controller do
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
it { expect(subject).to redirect_to(admin_procedure_types_de_champ_path(procedure_id: Procedure.last.id)) }
|
it { expect(subject).to redirect_to(admin_procedure_types_de_champ_path(procedure_id: Procedure.last.id)) }
|
||||||
|
|
||||||
it { expect(flash[:notice]).to be_present }
|
it { expect(flash[:notice]).to be_present }
|
||||||
end
|
end
|
||||||
|
@ -178,13 +178,27 @@ describe Admin::ProceduresController, type: :controller do
|
||||||
|
|
||||||
context 'when admin is the owner of the procedure' do
|
context 'when admin is the owner of the procedure' do
|
||||||
before do
|
before do
|
||||||
put :archive, procedure_id: procedure.id, archive: !procedure.archived
|
put :archive, procedure_id: procedure.id, archive: archive
|
||||||
procedure.reload
|
procedure.reload
|
||||||
end
|
end
|
||||||
|
|
||||||
it { expect(procedure.archived).to be_truthy }
|
context 'when owner want archive procedure' do
|
||||||
it { expect(response).to redirect_to :admin_procedures }
|
|
||||||
it { expect(flash[:notice]).to have_content 'Procédure éditée' }
|
let(:archive) { true }
|
||||||
|
|
||||||
|
it { expect(procedure.archived).to be_truthy }
|
||||||
|
it { expect(response).to redirect_to :admin_procedures }
|
||||||
|
it { expect(flash[:notice]).to have_content 'Procédure éditée' }
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'when owner want reactive procedure' do
|
||||||
|
|
||||||
|
let(:archive) { false }
|
||||||
|
|
||||||
|
it { expect(procedure.archived).to be_falsey }
|
||||||
|
it { expect(response).to redirect_to :admin_procedures }
|
||||||
|
it { expect(flash[:notice]).to have_content 'Procédure éditée' }
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when admin is not the owner of the procedure' do
|
context 'when admin is not the owner of the procedure' do
|
||||||
|
|
|
@ -124,7 +124,7 @@ describe Users::DossiersController, type: :controller do
|
||||||
describe 'PUT #update' do
|
describe 'PUT #update' do
|
||||||
before do
|
before do
|
||||||
sign_in dossier.user
|
sign_in dossier.user
|
||||||
put :update, id: dossier_id, dossier: {autorisation_donnees: autorisation_donnees}
|
put :update, id: dossier_id, dossier: { autorisation_donnees: autorisation_donnees }
|
||||||
end
|
end
|
||||||
context 'when Checkbox is checked' do
|
context 'when Checkbox is checked' do
|
||||||
let(:autorisation_donnees) { '1' }
|
let(:autorisation_donnees) { '1' }
|
||||||
|
@ -139,7 +139,7 @@ describe Users::DossiersController, type: :controller do
|
||||||
let(:use_api_carto) { true }
|
let(:use_api_carto) { true }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
put :update, id: dossier_id, dossier: {autorisation_donnees: autorisation_donnees}
|
put :update, id: dossier_id, dossier: { autorisation_donnees: autorisation_donnees }
|
||||||
end
|
end
|
||||||
it 'redirects to carte' do
|
it 'redirects to carte' do
|
||||||
expect(response).to redirect_to(controller: :carte, action: :show, dossier_id: dossier.id)
|
expect(response).to redirect_to(controller: :carte, action: :show, dossier_id: dossier.id)
|
||||||
|
@ -181,17 +181,17 @@ describe Users::DossiersController, type: :controller do
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when user is not the owner of the file' do
|
context 'when user is not the owner of the file' do
|
||||||
let(:user_2) { create(:user) }
|
let(:user_2) { create(:user) }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
sign_in user_2
|
sign_in user_2
|
||||||
|
|
||||||
put :archive, dossier_id: dossier.id
|
put :archive, dossier_id: dossier.id
|
||||||
procedure.reload
|
procedure.reload
|
||||||
end
|
end
|
||||||
|
|
||||||
it { expect(response).to redirect_to :users_dossiers }
|
it { expect(response).to redirect_to :users_dossiers }
|
||||||
it { expect(flash[:alert]).to have_content 'Dossier inéxistant' }
|
it { expect(flash[:alert]).to have_content 'Dossier inéxistant' }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -202,7 +202,7 @@ describe Users::DossiersController, type: :controller do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'returns http success' do
|
it 'returns http success' do
|
||||||
get :a_traiter
|
get :index, liste: :a_traiter
|
||||||
expect(response).to have_http_status(200)
|
expect(response).to have_http_status(200)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -215,7 +215,7 @@ describe Users::DossiersController, type: :controller do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'returns http success' do
|
it 'returns http success' do
|
||||||
get :en_attente
|
get :index, liste: :en_attente
|
||||||
expect(response).to have_http_status(200)
|
expect(response).to have_http_status(200)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -228,7 +228,7 @@ describe Users::DossiersController, type: :controller do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'returns http success' do
|
it 'returns http success' do
|
||||||
get :termine
|
get :index, liste: :termine
|
||||||
expect(response).to have_http_status(200)
|
expect(response).to have_http_status(200)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -10,7 +10,6 @@ describe Users::ProcedureController, type: :controller do
|
||||||
|
|
||||||
context 'when params procedure_id is present' do
|
context 'when params procedure_id is present' do
|
||||||
context 'when procedure_id is valid' do
|
context 'when procedure_id is valid' do
|
||||||
|
|
||||||
context 'when user is logged in' do
|
context 'when user is logged in' do
|
||||||
before do
|
before do
|
||||||
sign_in create(:user)
|
sign_in create(:user)
|
||||||
|
@ -18,11 +17,6 @@ describe Users::ProcedureController, type: :controller do
|
||||||
|
|
||||||
it { is_expected.to have_http_status(:success) }
|
it { is_expected.to have_http_status(:success) }
|
||||||
|
|
||||||
context 'when procedure_id is not valid' do
|
|
||||||
let(:procedure_id) { 0 }
|
|
||||||
it { is_expected.to have_http_status(404) }
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'when procedure is archived' do
|
context 'when procedure is archived' do
|
||||||
let(:procedure) { create(:procedure, archived: 'true') }
|
let(:procedure) { create(:procedure, archived: 'true') }
|
||||||
|
|
||||||
|
@ -33,6 +27,16 @@ describe Users::ProcedureController, type: :controller do
|
||||||
it { is_expected.to have_http_status(302) }
|
it { is_expected.to have_http_status(302) }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context 'when procedure_id is not valid' do
|
||||||
|
let(:procedure_id) { 0 }
|
||||||
|
|
||||||
|
before do
|
||||||
|
sign_in create(:user)
|
||||||
|
end
|
||||||
|
|
||||||
|
it { is_expected.to have_http_status(404) }
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -63,7 +63,7 @@ feature 'France Connect Connexion' do
|
||||||
context 'when starting page is dossiers list' do
|
context 'when starting page is dossiers list' do
|
||||||
let(:initial_path) { users_dossiers_path }
|
let(:initial_path) { users_dossiers_path }
|
||||||
scenario 'he is redirected to dossier list' do
|
scenario 'he is redirected to dossier list' do
|
||||||
expect(page).to have_css('#users_a_traiter')
|
expect(page).to have_css('#users_index')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
context 'when starting page is procedure' do
|
context 'when starting page is procedure' do
|
||||||
|
|
|
@ -1,31 +0,0 @@
|
||||||
require 'spec_helper'
|
|
||||||
|
|
||||||
describe 'users/dossiers/a_traiter.html.haml', type: :view do
|
|
||||||
let(:user) { create(:user) }
|
|
||||||
|
|
||||||
let!(:decorate_dossier) { create(:dossier, :with_procedure, user: user, state: 'replied').decorate }
|
|
||||||
let!(:decorate_dossier_2) { create(:dossier, :with_procedure, user: user, state: 'initiated', nom_projet: 'projet de test').decorate }
|
|
||||||
|
|
||||||
let(:dossiers_list) { user.dossiers.waiting_for_user.paginate(:page => 1).decorate }
|
|
||||||
|
|
||||||
before do
|
|
||||||
assign(:dossiers, dossiers_list)
|
|
||||||
assign(:dossiers_a_traiter, dossiers_list)
|
|
||||||
render
|
|
||||||
end
|
|
||||||
|
|
||||||
subject { rendered }
|
|
||||||
|
|
||||||
it { is_expected.to have_css('#users_a_traiter') }
|
|
||||||
|
|
||||||
describe 'dossier replied is present' do
|
|
||||||
it { is_expected.to have_content(decorate_dossier.procedure.libelle) }
|
|
||||||
it { is_expected.to have_content(decorate_dossier.nom_projet) }
|
|
||||||
it { is_expected.to have_content(decorate_dossier.state_fr) }
|
|
||||||
it { is_expected.to have_content(decorate_dossier.last_update) }
|
|
||||||
end
|
|
||||||
|
|
||||||
describe 'dossier initiated is not present' do
|
|
||||||
it { is_expected.not_to have_content(decorate_dossier_2.nom_projet) }
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -1,31 +0,0 @@
|
||||||
require 'spec_helper'
|
|
||||||
|
|
||||||
describe 'users/dossiers/en_attente.html.haml', type: :view do
|
|
||||||
let(:user) { create(:user) }
|
|
||||||
|
|
||||||
let!(:decorate_dossier) { create(:dossier, :with_procedure, user: user, state: 'initiated', nom_projet: 'projet de test').decorate }
|
|
||||||
let!(:decorate_dossier_2) { create(:dossier, :with_procedure, user: user, state: 'replied').decorate }
|
|
||||||
|
|
||||||
let(:dossiers_list) { user.dossiers.waiting_for_gestionnaire.paginate(:page => 1).decorate }
|
|
||||||
|
|
||||||
before do
|
|
||||||
assign(:dossiers, dossiers_list)
|
|
||||||
assign(:dossiers_en_attente, dossiers_list)
|
|
||||||
render
|
|
||||||
end
|
|
||||||
|
|
||||||
subject { rendered }
|
|
||||||
|
|
||||||
it { is_expected.to have_css('#users_en_attente') }
|
|
||||||
|
|
||||||
describe 'dossier initiated is present' do
|
|
||||||
it { is_expected.to have_content(decorate_dossier.procedure.libelle) }
|
|
||||||
it { is_expected.to have_content(decorate_dossier.nom_projet) }
|
|
||||||
it { is_expected.to have_content(decorate_dossier.state_fr) }
|
|
||||||
it { is_expected.to have_content(decorate_dossier.last_update) }
|
|
||||||
end
|
|
||||||
|
|
||||||
describe 'dossier replied is not present' do
|
|
||||||
it { is_expected.not_to have_content(decorate_dossier_2.nom_projet) }
|
|
||||||
end
|
|
||||||
end
|
|
93
spec/views/users/dossiers/index_html.haml_spec.rb
Normal file
93
spec/views/users/dossiers/index_html.haml_spec.rb
Normal file
|
@ -0,0 +1,93 @@
|
||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
|
describe 'users/dossiers/index.html.haml', type: :view do
|
||||||
|
let(:user) { create(:user) }
|
||||||
|
|
||||||
|
let!(:dossier) { create(:dossier, :with_procedure, user: user, state: 'initiated', nom_projet: 'projet de test').decorate }
|
||||||
|
let!(:dossier_2) { create(:dossier, :with_procedure, user: user, state: 'replied', nom_projet: 'projet répondu').decorate }
|
||||||
|
let!(:dossier_termine) { create(:dossier, :with_procedure, user: user, state: 'closed').decorate }
|
||||||
|
|
||||||
|
describe 'params liste is a_traiter' do
|
||||||
|
let(:dossiers_list) { user.dossiers.waiting_for_user('DESC') }
|
||||||
|
|
||||||
|
before do
|
||||||
|
sign_in user
|
||||||
|
|
||||||
|
assign(:dossiers, dossiers_list.paginate(:page => 1).decorate)
|
||||||
|
assign(:liste, 'a_traiter')
|
||||||
|
render
|
||||||
|
end
|
||||||
|
|
||||||
|
subject { rendered }
|
||||||
|
|
||||||
|
it { is_expected.to have_css('#users_index') }
|
||||||
|
|
||||||
|
describe 'dossier replied is present' do
|
||||||
|
it { is_expected.to have_content(dossier_2.procedure.libelle) }
|
||||||
|
it { is_expected.to have_content(dossier_2.nom_projet) }
|
||||||
|
it { is_expected.to have_content(dossier_2.state_fr) }
|
||||||
|
it { is_expected.to have_content(dossier_2.last_update) }
|
||||||
|
end
|
||||||
|
|
||||||
|
describe 'dossier initiated and closed are not present' do
|
||||||
|
it { is_expected.not_to have_content(dossier.nom_projet) }
|
||||||
|
it { is_expected.not_to have_content(dossier_termine.nom_projet) }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe 'params liste is en_attente' do
|
||||||
|
let(:dossiers_list) { user.dossiers.waiting_for_gestionnaire('DESC') }
|
||||||
|
|
||||||
|
before do
|
||||||
|
sign_in user
|
||||||
|
|
||||||
|
assign(:dossiers, dossiers_list.paginate(:page => 1).decorate)
|
||||||
|
assign(:liste, 'en_attente')
|
||||||
|
render
|
||||||
|
end
|
||||||
|
|
||||||
|
subject { rendered }
|
||||||
|
|
||||||
|
it { is_expected.to have_css('#users_index') }
|
||||||
|
|
||||||
|
describe 'dossier initiated is present' do
|
||||||
|
it { is_expected.to have_content(dossier.procedure.libelle) }
|
||||||
|
it { is_expected.to have_content(dossier.nom_projet) }
|
||||||
|
it { is_expected.to have_content(dossier.state_fr) }
|
||||||
|
it { is_expected.to have_content(dossier.last_update) }
|
||||||
|
end
|
||||||
|
|
||||||
|
describe 'dossier replied and closed are not present' do
|
||||||
|
it { is_expected.not_to have_content(dossier_2.nom_projet) }
|
||||||
|
it { is_expected.not_to have_content(dossier_termine.nom_projet) }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe 'params liste is termine' do
|
||||||
|
let(:dossiers_list) { user.dossiers.termine('DESC') }
|
||||||
|
|
||||||
|
before do
|
||||||
|
sign_in user
|
||||||
|
|
||||||
|
assign(:dossiers, dossiers_list.paginate(:page => 1).decorate)
|
||||||
|
assign(:liste, 'termine')
|
||||||
|
render
|
||||||
|
end
|
||||||
|
|
||||||
|
subject { rendered }
|
||||||
|
|
||||||
|
it { is_expected.to have_css('#users_index') }
|
||||||
|
|
||||||
|
describe 'dossier termine is present' do
|
||||||
|
it { is_expected.to have_content(dossier_termine.procedure.libelle) }
|
||||||
|
it { is_expected.to have_content(dossier_termine.nom_projet) }
|
||||||
|
it { is_expected.to have_content(dossier_termine.state_fr) }
|
||||||
|
it { is_expected.to have_content(dossier_termine.last_update) }
|
||||||
|
end
|
||||||
|
|
||||||
|
describe 'dossier initiated and replied are not present' do
|
||||||
|
it { is_expected.not_to have_content(dossier.nom_projet) }
|
||||||
|
it { is_expected.not_to have_content(dossier_2.nom_projet) }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -1,33 +0,0 @@
|
||||||
require 'spec_helper'
|
|
||||||
|
|
||||||
describe 'users/dossiers/termine.html.haml', type: :view do
|
|
||||||
let(:user) { create(:user) }
|
|
||||||
|
|
||||||
let!(:decorate_dossier) { create(:dossier, :with_procedure, user: user, state: 'initiated', nom_projet: 'projet de test').decorate }
|
|
||||||
let!(:decorate_dossier_2) { create(:dossier, :with_procedure, user: user, state: 'replied', nom_projet: 'projet terminé').decorate }
|
|
||||||
let!(:dossier_termine) { create(:dossier, :with_procedure, user: user, state: 'closed').decorate }
|
|
||||||
|
|
||||||
let(:dossiers_list) { user.dossiers.termine.paginate(:page => 1).decorate }
|
|
||||||
|
|
||||||
before do
|
|
||||||
assign(:dossiers, dossiers_list)
|
|
||||||
assign(:dossiers_en_attente, dossiers_list)
|
|
||||||
render
|
|
||||||
end
|
|
||||||
|
|
||||||
subject { rendered }
|
|
||||||
|
|
||||||
it { is_expected.to have_css('#users_termine') }
|
|
||||||
|
|
||||||
describe 'dossier termine is present' do
|
|
||||||
it { is_expected.to have_content(dossier_termine.procedure.libelle) }
|
|
||||||
it { is_expected.to have_content(dossier_termine.nom_projet) }
|
|
||||||
it { is_expected.to have_content(dossier_termine.state_fr) }
|
|
||||||
it { is_expected.to have_content(dossier_termine.last_update) }
|
|
||||||
end
|
|
||||||
|
|
||||||
describe 'dossier replied and initiated are not present' do
|
|
||||||
it { is_expected.not_to have_content(decorate_dossier.nom_projet) }
|
|
||||||
it { is_expected.not_to have_content(decorate_dossier_2.nom_projet) }
|
|
||||||
end
|
|
||||||
end
|
|
Loading…
Reference in a new issue