- 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
|
||||
@procedures = current_administrateur.procedures.where(archived: false)
|
||||
@procedures = @procedures.paginate(:page => params[:page])
|
||||
.paginate(:page => params[:page])
|
||||
end
|
||||
|
||||
def archived
|
||||
@procedures_archived = current_administrateur.procedures.where(archived: true)
|
||||
@procedures_archived = @procedures_archived.paginate(:page => params[:page])
|
||||
.paginate(:page => params[:page])
|
||||
end
|
||||
|
||||
def show
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
class DemoController < ApplicationController
|
||||
|
||||
def index
|
||||
@procedures = Procedure.all.where(archived: false).order('libelle ASC')
|
||||
@procedures = Procedure.where(archived: false).order('libelle ASC')
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -2,14 +2,37 @@ class Users::DossiersController < UsersController
|
|||
before_action :authenticate_user!
|
||||
|
||||
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
|
||||
|
||||
def show
|
||||
@dossier = current_user_dossier params[:id]
|
||||
|
||||
@etablissement = @dossier.etablissement
|
||||
@entreprise = @dossier.entreprise.decorate
|
||||
@etablissement = @dossier.etablissement
|
||||
@entreprise = @dossier.entreprise.decorate
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
flash.alert = t('errors.messages.dossier_not_found')
|
||||
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)
|
||||
end
|
||||
else
|
||||
@etablissement = @dossier.etablissement
|
||||
@entreprise = @dossier.entreprise.decorate
|
||||
@etablissement = @dossier.etablissement
|
||||
@entreprise = @dossier.entreprise.decorate
|
||||
flash.now.alert = 'Les conditions sont obligatoires.'
|
||||
render 'show'
|
||||
end
|
||||
|
@ -79,36 +102,6 @@ class Users::DossiersController < UsersController
|
|||
redirect_to users_dossiers_path
|
||||
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
|
||||
|
||||
def update_params
|
||||
|
|
|
@ -3,20 +3,22 @@
|
|||
|
||||
#onglets
|
||||
%ul.nav.nav-tabs
|
||||
%li{class: "#{'active' unless @dossiers_a_traiter.nil? }"}
|
||||
%a{:href => "#{url_for :users_dossiers_a_traiter}"}
|
||||
%li{ class: (@dossiers.active_class_a_traiter(@liste) unless @dossiers.nil?) }
|
||||
%a{:href => "#{url_for users_dossiers_path(liste: 'a_traiter')}"}
|
||||
%h5.text-danger
|
||||
= "À traiter "
|
||||
.badge.progress-bar-danger
|
||||
= @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
|
||||
="En attente "
|
||||
.badge.progress-bar-info
|
||||
= @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
|
||||
= "Terminé"
|
||||
.badge.progress-bar-success
|
||||
|
|
|
@ -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: 'list'
|
|
@ -24,12 +24,7 @@ Rails.application.routes.draw do
|
|||
get 'siret' => 'siret#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
|
||||
|
||||
get '/description' => 'description#show'
|
||||
get '/description/error' => 'description#error'
|
||||
post 'description' => 'description#create'
|
||||
|
@ -87,58 +82,58 @@ Rails.application.routes.draw do
|
|||
resources :commentaires, only: [:create]
|
||||
end
|
||||
|
||||
# The priority is based upon order of creation: first created -> highest priority.
|
||||
# See how all your routes lay out with "rake routes".
|
||||
# The priority is based upon order of creation: first created -> highest priority.
|
||||
# See how all your routes lay out with "rake routes".
|
||||
|
||||
# You can have the root of your site routed with "root"
|
||||
# root 'welcome#index'
|
||||
# You can have the root of your site routed with "root"
|
||||
# root 'welcome#index'
|
||||
|
||||
# Example of regular route:
|
||||
# get 'products/:id' => 'catalog#view'
|
||||
# Example of regular route:
|
||||
# get 'products/:id' => 'catalog#view'
|
||||
|
||||
# Example of named route that can be invoked with purchase_url(id: product.id)
|
||||
# get 'products/:id/purchase' => 'catalog#purchase', as: :purchase
|
||||
# Example of named route that can be invoked with purchase_url(id: product.id)
|
||||
# get 'products/:id/purchase' => 'catalog#purchase', as: :purchase
|
||||
|
||||
# Example resource route (maps HTTP verbs to controller actions automatically):
|
||||
# resources :products
|
||||
# Example resource route (maps HTTP verbs to controller actions automatically):
|
||||
# resources :products
|
||||
|
||||
# Example resource route with options:
|
||||
# resources :products do
|
||||
# member do
|
||||
# get 'short'
|
||||
# post 'toggle'
|
||||
# end
|
||||
#
|
||||
# collection do
|
||||
# get 'sold'
|
||||
# end
|
||||
# end
|
||||
# Example resource route with options:
|
||||
# resources :products do
|
||||
# member do
|
||||
# get 'short'
|
||||
# post 'toggle'
|
||||
# end
|
||||
#
|
||||
# collection do
|
||||
# get 'sold'
|
||||
# end
|
||||
# end
|
||||
|
||||
# Example resource route with sub-resources:
|
||||
# resources :products do
|
||||
# resources :comments, :sales
|
||||
# resource :seller
|
||||
# end
|
||||
# Example resource route with sub-resources:
|
||||
# resources :products do
|
||||
# resources :comments, :sales
|
||||
# resource :seller
|
||||
# end
|
||||
|
||||
# Example resource route with more complex sub-resources:
|
||||
# resources :products do
|
||||
# resources :comments
|
||||
# resources :sales do
|
||||
# get 'recent', on: :collection
|
||||
# end
|
||||
# end
|
||||
# Example resource route with more complex sub-resources:
|
||||
# resources :products do
|
||||
# resources :comments
|
||||
# resources :sales do
|
||||
# get 'recent', on: :collection
|
||||
# end
|
||||
# end
|
||||
|
||||
# Example resource route with concerns:
|
||||
# concern :toggleable do
|
||||
# post 'toggle'
|
||||
# end
|
||||
# resources :posts, concerns: :toggleable
|
||||
# resources :photos, concerns: :toggleable
|
||||
# Example resource route with concerns:
|
||||
# concern :toggleable do
|
||||
# post 'toggle'
|
||||
# end
|
||||
# resources :posts, concerns: :toggleable
|
||||
# resources :photos, concerns: :toggleable
|
||||
|
||||
# Example resource route within a namespace:
|
||||
# namespace :admin do
|
||||
# # Directs /admin/products/* to Admin::ProductsController
|
||||
# # (app/controllers/admin/products_controller.rb)
|
||||
# resources :products
|
||||
# end
|
||||
# Example resource route within a namespace:
|
||||
# namespace :admin do
|
||||
# # Directs /admin/products/* to Admin::ProductsController
|
||||
# # (app/controllers/admin/products_controller.rb)
|
||||
# resources :products
|
||||
# end
|
||||
end
|
||||
|
|
|
@ -14,12 +14,12 @@ describe Admin::ProceduresController, type: :controller do
|
|||
|
||||
let(:procedure_params) {
|
||||
{
|
||||
libelle: libelle,
|
||||
description: description,
|
||||
organisation: organisation,
|
||||
direction: direction,
|
||||
lien_demarche: lien_demarche,
|
||||
use_api_carto: use_api_carto
|
||||
libelle: libelle,
|
||||
description: description,
|
||||
organisation: organisation,
|
||||
direction: direction,
|
||||
lien_demarche: lien_demarche,
|
||||
use_api_carto: use_api_carto
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -94,7 +94,7 @@ describe Admin::ProceduresController, type: :controller do
|
|||
|
||||
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 }
|
||||
end
|
||||
|
@ -178,13 +178,27 @@ describe Admin::ProceduresController, type: :controller do
|
|||
|
||||
context 'when admin is the owner of the procedure' do
|
||||
before do
|
||||
put :archive, procedure_id: procedure.id, archive: !procedure.archived
|
||||
put :archive, procedure_id: procedure.id, archive: archive
|
||||
procedure.reload
|
||||
end
|
||||
|
||||
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' }
|
||||
context 'when owner want archive procedure' do
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
before do
|
||||
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
|
||||
context 'when Checkbox is checked' do
|
||||
let(:autorisation_donnees) { '1' }
|
||||
|
@ -139,7 +139,7 @@ describe Users::DossiersController, type: :controller do
|
|||
let(:use_api_carto) { true }
|
||||
|
||||
before do
|
||||
put :update, id: dossier_id, dossier: {autorisation_donnees: autorisation_donnees}
|
||||
put :update, id: dossier_id, dossier: { autorisation_donnees: autorisation_donnees }
|
||||
end
|
||||
it 'redirects to carte' do
|
||||
expect(response).to redirect_to(controller: :carte, action: :show, dossier_id: dossier.id)
|
||||
|
@ -181,17 +181,17 @@ describe Users::DossiersController, type: :controller do
|
|||
end
|
||||
|
||||
context 'when user is not the owner of the file' do
|
||||
let(:user_2) { create(:user) }
|
||||
let(:user_2) { create(:user) }
|
||||
|
||||
before do
|
||||
sign_in user_2
|
||||
before do
|
||||
sign_in user_2
|
||||
|
||||
put :archive, dossier_id: dossier.id
|
||||
procedure.reload
|
||||
end
|
||||
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' }
|
||||
it { expect(response).to redirect_to :users_dossiers }
|
||||
it { expect(flash[:alert]).to have_content 'Dossier inéxistant' }
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -202,7 +202,7 @@ describe Users::DossiersController, type: :controller do
|
|||
end
|
||||
|
||||
it 'returns http success' do
|
||||
get :a_traiter
|
||||
get :index, liste: :a_traiter
|
||||
expect(response).to have_http_status(200)
|
||||
end
|
||||
end
|
||||
|
@ -215,7 +215,7 @@ describe Users::DossiersController, type: :controller do
|
|||
end
|
||||
|
||||
it 'returns http success' do
|
||||
get :en_attente
|
||||
get :index, liste: :en_attente
|
||||
expect(response).to have_http_status(200)
|
||||
end
|
||||
end
|
||||
|
@ -228,7 +228,7 @@ describe Users::DossiersController, type: :controller do
|
|||
end
|
||||
|
||||
it 'returns http success' do
|
||||
get :termine
|
||||
get :index, liste: :termine
|
||||
expect(response).to have_http_status(200)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -10,7 +10,6 @@ describe Users::ProcedureController, type: :controller do
|
|||
|
||||
context 'when params procedure_id is present' do
|
||||
context 'when procedure_id is valid' do
|
||||
|
||||
context 'when user is logged in' do
|
||||
before do
|
||||
sign_in create(:user)
|
||||
|
@ -18,11 +17,6 @@ describe Users::ProcedureController, type: :controller do
|
|||
|
||||
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
|
||||
let(:procedure) { create(:procedure, archived: 'true') }
|
||||
|
||||
|
@ -33,6 +27,16 @@ describe Users::ProcedureController, type: :controller do
|
|||
it { is_expected.to have_http_status(302) }
|
||||
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
|
||||
|
|
|
@ -63,7 +63,7 @@ feature 'France Connect Connexion' do
|
|||
context 'when starting page is dossiers list' do
|
||||
let(:initial_path) { users_dossiers_path }
|
||||
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
|
||||
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