Enable some Rails cops
This commit is contained in:
parent
da3d9d403a
commit
0a9f442260
83 changed files with 180 additions and 178 deletions
44
.rubocop.yml
44
.rubocop.yml
|
@ -640,22 +640,22 @@ Performance/UriDefaultParser:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
|
||||||
Rails/ActionFilter:
|
Rails/ActionFilter:
|
||||||
Enabled: false
|
Enabled: true
|
||||||
|
|
||||||
Rails/ActiveRecordAliases:
|
Rails/ActiveRecordAliases:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
|
||||||
Rails/ActiveSupportAliases:
|
Rails/ActiveSupportAliases:
|
||||||
Enabled: false
|
Enabled: true
|
||||||
|
|
||||||
Rails/ApplicationJob:
|
Rails/ApplicationJob:
|
||||||
Enabled: false
|
Enabled: true
|
||||||
|
|
||||||
Rails/ApplicationRecord:
|
Rails/ApplicationRecord:
|
||||||
Enabled: false
|
Enabled: true
|
||||||
|
|
||||||
Rails/Blank:
|
Rails/Blank:
|
||||||
Enabled: false
|
Enabled: true
|
||||||
|
|
||||||
Rails/CreateTableWithTimestamps:
|
Rails/CreateTableWithTimestamps:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
@ -667,28 +667,30 @@ Rails/Delegate:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
Rails/DelegateAllowBlank:
|
Rails/DelegateAllowBlank:
|
||||||
Enabled: false
|
Enabled: true
|
||||||
|
|
||||||
Rails/DynamicFindBy:
|
Rails/DynamicFindBy:
|
||||||
Enabled: false
|
Enabled: true
|
||||||
|
Exclude:
|
||||||
|
- "spec/features/**/*.rb"
|
||||||
|
|
||||||
Rails/EnumUniqueness:
|
Rails/EnumUniqueness:
|
||||||
Enabled: false
|
Enabled: true
|
||||||
|
|
||||||
Rails/EnvironmentComparison:
|
Rails/EnvironmentComparison:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
Rails/Exit:
|
Rails/Exit:
|
||||||
Enabled: false
|
Enabled: true
|
||||||
|
|
||||||
Rails/FilePath:
|
Rails/FilePath:
|
||||||
Enabled: false
|
Enabled: true
|
||||||
|
|
||||||
Rails/FindBy:
|
Rails/FindBy:
|
||||||
Enabled: false
|
Enabled: true
|
||||||
|
|
||||||
Rails/FindEach:
|
Rails/FindEach:
|
||||||
Enabled: false
|
Enabled: true
|
||||||
|
|
||||||
Rails/HasAndBelongsToMany:
|
Rails/HasAndBelongsToMany:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
@ -697,7 +699,7 @@ Rails/HasManyOrHasOneDependent:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
Rails/HttpPositionalArguments:
|
Rails/HttpPositionalArguments:
|
||||||
Enabled: false
|
Enabled: true
|
||||||
|
|
||||||
Rails/InverseOf:
|
Rails/InverseOf:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
@ -715,10 +717,10 @@ Rails/OutputSafety:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
|
||||||
Rails/PluralizationGrammar:
|
Rails/PluralizationGrammar:
|
||||||
Enabled: false
|
Enabled: true
|
||||||
|
|
||||||
Rails/Presence:
|
Rails/Presence:
|
||||||
Enabled: false
|
Enabled: true
|
||||||
|
|
||||||
Rails/Present:
|
Rails/Present:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
@ -730,22 +732,22 @@ Rails/RedundantReceiverInWithOptions:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
|
||||||
Rails/RelativeDateConstant:
|
Rails/RelativeDateConstant:
|
||||||
Enabled: false
|
Enabled: true
|
||||||
|
|
||||||
Rails/RequestReferer:
|
Rails/RequestReferer:
|
||||||
Enabled: false
|
Enabled: true
|
||||||
|
|
||||||
Rails/ReversibleMigration:
|
Rails/ReversibleMigration:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
Rails/SafeNavigation:
|
Rails/SafeNavigation:
|
||||||
Enabled: false
|
Enabled: true
|
||||||
|
|
||||||
Rails/SaveBang:
|
Rails/SaveBang:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
Rails/ScopeArgs:
|
Rails/ScopeArgs:
|
||||||
Enabled: false
|
Enabled: true
|
||||||
|
|
||||||
Rails/SkipsModelValidations:
|
Rails/SkipsModelValidations:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
@ -754,13 +756,13 @@ Rails/TimeZone:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
Rails/UniqBeforePluck:
|
Rails/UniqBeforePluck:
|
||||||
Enabled: false
|
Enabled: true
|
||||||
|
|
||||||
Rails/UnknownEnv:
|
Rails/UnknownEnv:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
Rails/Validation:
|
Rails/Validation:
|
||||||
Enabled: false
|
Enabled: true
|
||||||
|
|
||||||
Rails:
|
Rails:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
|
|
@ -19,7 +19,7 @@ class Admin::GestionnairesController < AdminController
|
||||||
|
|
||||||
def create
|
def create
|
||||||
email = params[:gestionnaire][:email].downcase
|
email = params[:gestionnaire][:email].downcase
|
||||||
@gestionnaire = Gestionnaire.find_by_email(email)
|
@gestionnaire = Gestionnaire.find_by(email: email)
|
||||||
procedure_id = params[:procedure_id]
|
procedure_id = params[:procedure_id]
|
||||||
|
|
||||||
if @gestionnaire.nil?
|
if @gestionnaire.nil?
|
||||||
|
|
|
@ -132,7 +132,7 @@ class Admin::ProceduresController < AdminController
|
||||||
return redirect_to admin_procedures_path
|
return redirect_to admin_procedures_path
|
||||||
end
|
end
|
||||||
|
|
||||||
procedure_path = ProcedurePath.find_by_path(params[:procedure_path])
|
procedure_path = ProcedurePath.find_by(path: params[:procedure_path])
|
||||||
if procedure_path
|
if procedure_path
|
||||||
if procedure_path.administrateur_id == current_administrateur.id
|
if procedure_path.administrateur_id == current_administrateur.id
|
||||||
procedure_path.procedure.archive
|
procedure_path.procedure.archive
|
||||||
|
@ -154,7 +154,7 @@ class Admin::ProceduresController < AdminController
|
||||||
end
|
end
|
||||||
|
|
||||||
def transfer
|
def transfer
|
||||||
admin = Administrateur.find_by_email(params[:email_admin].downcase)
|
admin = Administrateur.find_by(email: params[:email_admin].downcase)
|
||||||
|
|
||||||
if admin.nil?
|
if admin.nil?
|
||||||
render '/admin/procedures/transfer', formats: 'js', status: 404
|
render '/admin/procedures/transfer', formats: 'js', status: 404
|
||||||
|
|
|
@ -13,7 +13,7 @@ class APIController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def current_administrateur
|
def current_administrateur
|
||||||
@administrateur ||= Administrateur.find_by_api_token(params[:token])
|
@administrateur ||= Administrateur.find_by(api_token: params[:token])
|
||||||
end
|
end
|
||||||
|
|
||||||
def default_format_json
|
def default_format_json
|
||||||
|
|
|
@ -9,7 +9,7 @@ class InvitesController < ApplicationController
|
||||||
|
|
||||||
email = params[:email].downcase
|
email = params[:email].downcase
|
||||||
|
|
||||||
user = User.find_by_email(email)
|
user = User.find_by(email: email)
|
||||||
invite = class_var.create(dossier: dossier, user: user, email: email, email_sender: email_sender)
|
invite = class_var.create(dossier: dossier, user: user, email: email, email_sender: email_sender)
|
||||||
|
|
||||||
if invite.valid?
|
if invite.valid?
|
||||||
|
|
|
@ -13,7 +13,7 @@ module NewGestionnaire
|
||||||
@avis_a_donner = gestionnaire_avis.without_answer
|
@avis_a_donner = gestionnaire_avis.without_answer
|
||||||
@avis_donnes = gestionnaire_avis.with_answer
|
@avis_donnes = gestionnaire_avis.with_answer
|
||||||
|
|
||||||
@statut = params[:statut].present? ? params[:statut] : A_DONNER_STATUS
|
@statut = params[:statut].presence || A_DONNER_STATUS
|
||||||
|
|
||||||
@avis = case @statut
|
@avis = case @statut
|
||||||
when A_DONNER_STATUS
|
when A_DONNER_STATUS
|
||||||
|
|
|
@ -76,7 +76,7 @@ module NewGestionnaire
|
||||||
filtered_sorted_ids = sorted_ids
|
filtered_sorted_ids = sorted_ids
|
||||||
end
|
end
|
||||||
|
|
||||||
page = params[:page].present? ? params[:page] : 1
|
page = params[:page].presence || 1
|
||||||
|
|
||||||
filtered_sorted_paginated_ids = Kaminari
|
filtered_sorted_paginated_ids = Kaminari
|
||||||
.paginate_array(filtered_sorted_ids)
|
.paginate_array(filtered_sorted_ids)
|
||||||
|
@ -187,7 +187,7 @@ module NewGestionnaire
|
||||||
private
|
private
|
||||||
|
|
||||||
def statut
|
def statut
|
||||||
@statut ||= params[:statut].present? ? params[:statut] : 'a-suivre'
|
@statut ||= (params[:statut].presence || 'a-suivre')
|
||||||
end
|
end
|
||||||
|
|
||||||
def procedure
|
def procedure
|
||||||
|
|
|
@ -170,7 +170,7 @@ class StatsController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def avis_usage
|
def avis_usage
|
||||||
[3.week.ago, 2.week.ago, 1.week.ago].map do |min_date|
|
[3.weeks.ago, 2.weeks.ago, 1.week.ago].map do |min_date|
|
||||||
max_date = min_date + 1.week
|
max_date = min_date + 1.week
|
||||||
|
|
||||||
weekly_dossiers = Dossier.includes(:avis).where(created_at: min_date..max_date).to_a
|
weekly_dossiers = Dossier.includes(:avis).where(created_at: min_date..max_date).to_a
|
||||||
|
@ -189,7 +189,7 @@ class StatsController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def avis_average_answer_time
|
def avis_average_answer_time
|
||||||
[3.week.ago, 2.week.ago, 1.week.ago].map do |min_date|
|
[3.weeks.ago, 2.weeks.ago, 1.week.ago].map do |min_date|
|
||||||
max_date = min_date + 1.week
|
max_date = min_date + 1.week
|
||||||
|
|
||||||
average = Avis.with_answer
|
average = Avis.with_answer
|
||||||
|
@ -203,7 +203,7 @@ class StatsController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def avis_answer_percentages
|
def avis_answer_percentages
|
||||||
[3.week.ago, 2.week.ago, 1.week.ago].map do |min_date|
|
[3.weeks.ago, 2.weeks.ago, 1.week.ago].map do |min_date|
|
||||||
max_date = min_date + 1.week
|
max_date = min_date + 1.week
|
||||||
|
|
||||||
weekly_avis = Avis.where(created_at: min_date..max_date)
|
weekly_avis = Avis.where(created_at: min_date..max_date)
|
||||||
|
@ -222,7 +222,7 @@ class StatsController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def motivation_usage_dossier
|
def motivation_usage_dossier
|
||||||
[3.week.ago, 2.week.ago, 1.week.ago].map do |date|
|
[3.weeks.ago, 2.weeks.ago, 1.week.ago].map do |date|
|
||||||
min_date = date.beginning_of_week
|
min_date = date.beginning_of_week
|
||||||
max_date = date.end_of_week
|
max_date = date.end_of_week
|
||||||
|
|
||||||
|
@ -241,7 +241,7 @@ class StatsController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def motivation_usage_procedure
|
def motivation_usage_procedure
|
||||||
[3.week.ago, 2.week.ago, 1.week.ago].map do |date|
|
[3.weeks.ago, 2.weeks.ago, 1.week.ago].map do |date|
|
||||||
min_date = date.beginning_of_week
|
min_date = date.beginning_of_week
|
||||||
max_date = date.end_of_week
|
max_date = date.end_of_week
|
||||||
|
|
||||||
|
|
|
@ -88,7 +88,7 @@ class Users::DescriptionController < UsersController
|
||||||
flash.notice = 'Nouveaux fichiers envoyés' if flash.alert.nil?
|
flash.notice = 'Nouveaux fichiers envoyés' if flash.alert.nil?
|
||||||
end
|
end
|
||||||
|
|
||||||
return redirect_to users_dossiers_invite_path(id: current_user.invites.find_by_dossier_id(@dossier.id).id) if invite
|
return redirect_to users_dossiers_invite_path(id: current_user.invites.find_by(dossier_id: @dossier.id).id) if invite
|
||||||
|
|
||||||
redirect_to users_dossier_recapitulatif_path
|
redirect_to users_dossier_recapitulatif_path
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
class Users::Dossiers::InvitesController < UsersController
|
class Users::Dossiers::InvitesController < UsersController
|
||||||
def authenticate_user!
|
def authenticate_user!
|
||||||
session["user_return_to"] = request.fullpath
|
session["user_return_to"] = request.fullpath
|
||||||
return redirect_to new_user_registration_path(user_email: params[:email]) if params[:email].present? && User.find_by_email(params[:email]).nil?
|
return redirect_to new_user_registration_path(user_email: params[:email]) if params[:email].present? && User.find_by(email: params[:email]).nil?
|
||||||
|
|
||||||
super
|
super
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,7 +2,7 @@ class EntrepriseDecorator < Draper::Decorator
|
||||||
delegate_all
|
delegate_all
|
||||||
|
|
||||||
def raison_sociale_or_name
|
def raison_sociale_or_name
|
||||||
raison_sociale.blank? ? "#{nom} #{prenom}" : raison_sociale
|
raison_sociale.presence || "#{nom} #{prenom}"
|
||||||
end
|
end
|
||||||
|
|
||||||
def effectif
|
def effectif
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
class Administrateur < ActiveRecord::Base
|
class Administrateur < ApplicationRecord
|
||||||
devise :database_authenticatable, :registerable,
|
devise :database_authenticatable, :registerable,
|
||||||
:recoverable, :rememberable, :trackable, :validatable
|
:recoverable, :rememberable, :trackable, :validatable
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
class Administration < ActiveRecord::Base
|
class Administration < ApplicationRecord
|
||||||
# Include default devise modules. Others available are:
|
# Include default devise modules. Others available are:
|
||||||
# :confirmable, :lockable, :timeoutable and :omniauthable
|
# :confirmable, :lockable, :timeoutable and :omniauthable
|
||||||
devise :database_authenticatable, :rememberable, :trackable, :validatable, :omniauthable, omniauth_providers: [:github]
|
devise :database_authenticatable, :rememberable, :trackable, :validatable, :omniauthable, omniauth_providers: [:github]
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
class AssignTo < ActiveRecord::Base
|
class AssignTo < ApplicationRecord
|
||||||
belongs_to :procedure
|
belongs_to :procedure
|
||||||
belongs_to :gestionnaire
|
belongs_to :gestionnaire
|
||||||
has_one :procedure_presentation, dependent: :destroy
|
has_one :procedure_presentation, dependent: :destroy
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
class Cadastre < ActiveRecord::Base
|
class Cadastre < ApplicationRecord
|
||||||
belongs_to :dossier, touch: true
|
belongs_to :dossier, touch: true
|
||||||
|
|
||||||
def geometry
|
def geometry
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
class Cerfa < ActiveRecord::Base
|
class Cerfa < ApplicationRecord
|
||||||
belongs_to :dossier, touch: true
|
belongs_to :dossier, touch: true
|
||||||
belongs_to :user
|
belongs_to :user
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
class Champ < ActiveRecord::Base
|
class Champ < ApplicationRecord
|
||||||
self.inheritance_column = :_type_disabled
|
self.inheritance_column = :_type_disabled
|
||||||
|
|
||||||
belongs_to :dossier, touch: true
|
belongs_to :dossier, touch: true
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
class Commentaire < ActiveRecord::Base
|
class Commentaire < ApplicationRecord
|
||||||
belongs_to :dossier, touch: true
|
belongs_to :dossier, touch: true
|
||||||
belongs_to :champ
|
belongs_to :champ
|
||||||
belongs_to :piece_justificative
|
belongs_to :piece_justificative
|
||||||
|
@ -6,7 +6,7 @@ class Commentaire < ActiveRecord::Base
|
||||||
mount_uploader :file, CommentaireFileUploader
|
mount_uploader :file, CommentaireFileUploader
|
||||||
validates :file, file_size: { maximum: 20.megabytes, message: "La taille du fichier doit être inférieure à 20 Mo" }
|
validates :file, file_size: { maximum: 20.megabytes, message: "La taille du fichier doit être inférieure à 20 Mo" }
|
||||||
validate :is_virus_free?
|
validate :is_virus_free?
|
||||||
validates_presence_of :body, message: "Votre message ne peut être vide"
|
validates :body, presence: { message: "Votre message ne peut être vide" }
|
||||||
|
|
||||||
default_scope { order(created_at: :asc) }
|
default_scope { order(created_at: :asc) }
|
||||||
scope :updated_since?, -> (date) { where('commentaires.updated_at > ?', date) }
|
scope :updated_since?, -> (date) { where('commentaires.updated_at > ?', date) }
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
class Dossier < ActiveRecord::Base
|
class Dossier < ApplicationRecord
|
||||||
enum state: {
|
enum state: {
|
||||||
brouillon: 'brouillon',
|
brouillon: 'brouillon',
|
||||||
en_construction: 'en_construction',
|
en_construction: 'en_construction',
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
class DropDownList < ActiveRecord::Base
|
class DropDownList < ApplicationRecord
|
||||||
belongs_to :type_de_champ
|
belongs_to :type_de_champ
|
||||||
|
|
||||||
def options
|
def options
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
class Entreprise < ActiveRecord::Base
|
class Entreprise < ApplicationRecord
|
||||||
belongs_to :dossier
|
belongs_to :dossier
|
||||||
has_one :etablissement, dependent: :destroy
|
has_one :etablissement, dependent: :destroy
|
||||||
has_one :rna_information, dependent: :destroy
|
has_one :rna_information, dependent: :destroy
|
||||||
|
|
||||||
validates_presence_of :siren
|
validates :siren, presence: true
|
||||||
validates_uniqueness_of :dossier_id
|
validates :dossier_id, uniqueness: true
|
||||||
|
|
||||||
accepts_nested_attributes_for :rna_information
|
accepts_nested_attributes_for :rna_information
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
class Etablissement < ActiveRecord::Base
|
class Etablissement < ApplicationRecord
|
||||||
belongs_to :dossier
|
belongs_to :dossier
|
||||||
belongs_to :entreprise
|
belongs_to :entreprise
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ class Etablissement < ActiveRecord::Base
|
||||||
accepts_nested_attributes_for :exercices
|
accepts_nested_attributes_for :exercices
|
||||||
accepts_nested_attributes_for :entreprise
|
accepts_nested_attributes_for :entreprise
|
||||||
|
|
||||||
validates_uniqueness_of :dossier_id
|
validates :dossier_id, uniqueness: true
|
||||||
|
|
||||||
def geo_adresse
|
def geo_adresse
|
||||||
[numero_voie, type_voie, nom_voie, complement_adresse, code_postal, localite].join(' ')
|
[numero_voie, type_voie, nom_voie, complement_adresse, code_postal, localite].join(' ')
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
class Exercice < ActiveRecord::Base
|
class Exercice < ApplicationRecord
|
||||||
belongs_to :etablissement
|
belongs_to :etablissement
|
||||||
|
|
||||||
validates :ca, presence: true, allow_blank: false, allow_nil: false
|
validates :ca, presence: true, allow_blank: false, allow_nil: false
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
class Follow < ActiveRecord::Base
|
class Follow < ApplicationRecord
|
||||||
belongs_to :gestionnaire
|
belongs_to :gestionnaire
|
||||||
belongs_to :dossier
|
belongs_to :dossier
|
||||||
|
|
||||||
validates_uniqueness_of :gestionnaire_id, :scope => :dossier_id
|
validates :gestionnaire_id, uniqueness: { scope: :dossier_id }
|
||||||
|
|
||||||
before_create :set_default_date
|
before_create :set_default_date
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
class FranceConnectInformation < ActiveRecord::Base
|
class FranceConnectInformation < ApplicationRecord
|
||||||
belongs_to :user
|
belongs_to :user
|
||||||
|
|
||||||
validates :france_connect_particulier_id, presence: true, allow_blank: false, allow_nil: false
|
validates :france_connect_particulier_id, presence: true, allow_blank: false, allow_nil: false
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
class Gestionnaire < ActiveRecord::Base
|
class Gestionnaire < ApplicationRecord
|
||||||
devise :database_authenticatable, :registerable,
|
devise :database_authenticatable, :registerable,
|
||||||
:recoverable, :rememberable, :trackable, :validatable
|
:recoverable, :rememberable, :trackable, :validatable
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
class Individual < ActiveRecord::Base
|
class Individual < ApplicationRecord
|
||||||
belongs_to :dossier
|
belongs_to :dossier
|
||||||
|
|
||||||
validates_uniqueness_of :dossier_id
|
validates :dossier_id, uniqueness: true
|
||||||
validates :gender, presence: true, allow_nil: false, on: :update
|
validates :gender, presence: true, allow_nil: false, on: :update
|
||||||
validates :nom, presence: true, allow_blank: false, allow_nil: false, on: :update
|
validates :nom, presence: true, allow_blank: false, allow_nil: false, on: :update
|
||||||
validates :prenom, presence: true, allow_blank: false, allow_nil: false, on: :update
|
validates :prenom, presence: true, allow_blank: false, allow_nil: false, on: :update
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
class Invite < ActiveRecord::Base
|
class Invite < ApplicationRecord
|
||||||
belongs_to :dossier
|
belongs_to :dossier
|
||||||
belongs_to :user
|
belongs_to :user
|
||||||
|
|
||||||
validates_presence_of :email
|
validates :email, presence: true
|
||||||
validates_uniqueness_of :email, :scope => :dossier_id
|
validates :email, uniqueness: { scope: :dossier_id }
|
||||||
|
|
||||||
validates :email, email_format: true
|
validates :email, email_format: true
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
class ModuleAPICarto < ActiveRecord::Base
|
class ModuleAPICarto < ApplicationRecord
|
||||||
belongs_to :procedure
|
belongs_to :procedure
|
||||||
|
|
||||||
validates :use_api_carto, presence: true, allow_blank: true, allow_nil: false
|
validates :use_api_carto, presence: true, allow_blank: true, allow_nil: false
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
class PieceJustificative < ActiveRecord::Base
|
class PieceJustificative < ApplicationRecord
|
||||||
belongs_to :dossier, touch: true
|
belongs_to :dossier, touch: true
|
||||||
belongs_to :type_de_piece_justificative
|
belongs_to :type_de_piece_justificative
|
||||||
has_one :commentaire
|
has_one :commentaire
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
class Procedure < ActiveRecord::Base
|
class Procedure < ApplicationRecord
|
||||||
has_many :types_de_piece_justificative, -> { order "order_place ASC" }, dependent: :destroy
|
has_many :types_de_piece_justificative, -> { order "order_place ASC" }, dependent: :destroy
|
||||||
has_many :types_de_champ, -> { public_only }, dependent: :destroy
|
has_many :types_de_champ, -> { public_only }, dependent: :destroy
|
||||||
has_many :types_de_champ_private, -> { private_only }, class_name: 'TypeDeChamp', dependent: :destroy
|
has_many :types_de_champ_private, -> { private_only }, class_name: 'TypeDeChamp', dependent: :destroy
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
class ProcedurePath < ActiveRecord::Base
|
class ProcedurePath < ApplicationRecord
|
||||||
validates :path, format: { with: /\A[a-z0-9_\-]{3,50}\z/ }, presence: true, allow_blank: false, allow_nil: false
|
validates :path, format: { with: /\A[a-z0-9_\-]{3,50}\z/ }, presence: true, allow_blank: false, allow_nil: false
|
||||||
validates :administrateur_id, presence: true, allow_blank: false, allow_nil: false
|
validates :administrateur_id, presence: true, allow_blank: false, allow_nil: false
|
||||||
validates :procedure_id, presence: true, allow_blank: false, allow_nil: false
|
validates :procedure_id, presence: true, allow_blank: false, allow_nil: false
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
class ProcedurePresentation < ActiveRecord::Base
|
class ProcedurePresentation < ApplicationRecord
|
||||||
belongs_to :assign_to
|
belongs_to :assign_to
|
||||||
|
|
||||||
def displayed_fields
|
def displayed_fields
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
class QuartierPrioritaire < ActiveRecord::Base
|
class QuartierPrioritaire < ApplicationRecord
|
||||||
belongs_to :dossier, touch: true
|
belongs_to :dossier, touch: true
|
||||||
|
|
||||||
def geometry
|
def geometry
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
class RNAInformation < ActiveRecord::Base
|
class RNAInformation < ApplicationRecord
|
||||||
belongs_to :entreprise
|
belongs_to :entreprise
|
||||||
|
|
||||||
validates :association_id, presence: true, allow_blank: false, allow_nil: false
|
validates :association_id, presence: true, allow_blank: false, allow_nil: false
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# See:
|
# See:
|
||||||
# - https://robots.thoughtbot.com/implementing-multi-table-full-text-search-with-postgres
|
# - https://robots.thoughtbot.com/implementing-multi-table-full-text-search-with-postgres
|
||||||
# - http://calebthompson.io/talks/search.html
|
# - http://calebthompson.io/talks/search.html
|
||||||
class Search < ActiveRecord::Base
|
class Search < ApplicationRecord
|
||||||
# :nodoc:
|
# :nodoc:
|
||||||
#
|
#
|
||||||
# Englobs a search result (actually a collection of Search objects) so it acts
|
# Englobs a search result (actually a collection of Search objects) so it acts
|
||||||
|
|
|
@ -4,7 +4,7 @@ class Siret
|
||||||
|
|
||||||
attr_accessor :siret
|
attr_accessor :siret
|
||||||
|
|
||||||
validates_presence_of :siret
|
validates :siret, presence: true
|
||||||
validates :siret, siret_format: true
|
validates :siret, siret_format: true
|
||||||
|
|
||||||
before_validation :remove_whitespace
|
before_validation :remove_whitespace
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
class TypeDeChamp < ActiveRecord::Base
|
class TypeDeChamp < ApplicationRecord
|
||||||
self.inheritance_column = :_type_disabled
|
self.inheritance_column = :_type_disabled
|
||||||
|
|
||||||
enum type_champs: {
|
enum type_champs: {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
class TypeDePieceJustificative < ActiveRecord::Base
|
class TypeDePieceJustificative < ApplicationRecord
|
||||||
has_many :pieces_justificatives, dependent: :destroy
|
has_many :pieces_justificatives, dependent: :destroy
|
||||||
|
|
||||||
belongs_to :procedure
|
belongs_to :procedure
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
class User < ActiveRecord::Base
|
class User < ApplicationRecord
|
||||||
enum loged_in_with_france_connect: {
|
enum loged_in_with_france_connect: {
|
||||||
particulier: 'particulier',
|
particulier: 'particulier',
|
||||||
entreprise: 'entreprise'
|
entreprise: 'entreprise'
|
||||||
|
@ -21,7 +21,7 @@ class User < ActiveRecord::Base
|
||||||
include CredentialsSyncableConcern
|
include CredentialsSyncableConcern
|
||||||
|
|
||||||
def self.find_for_france_connect email, siret
|
def self.find_for_france_connect email, siret
|
||||||
user = User.find_by_email(email)
|
user = User.find_by(email: email)
|
||||||
if user.nil?
|
if user.nil?
|
||||||
return User.create(email: email, password: Devise.friendly_token[0, 20], siret: siret)
|
return User.create(email: email, password: Devise.friendly_token[0, 20], siret: siret)
|
||||||
else
|
else
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
class StagingAuthService
|
class StagingAuthService
|
||||||
CONFIG_PATH = Rails.root.join("config/basic_auth.yml")
|
CONFIG_PATH = Rails.root.join("config", "basic_auth.yml")
|
||||||
|
|
||||||
def self.authenticate(username, password)
|
def self.authenticate(username, password)
|
||||||
if enabled?
|
if enabled?
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
class AttestationTemplateLogoUploader < BaseUploader
|
class AttestationTemplateLogoUploader < BaseUploader
|
||||||
def root
|
def root
|
||||||
File.join(Rails.root, 'public')
|
Rails.root.join("public")
|
||||||
end
|
end
|
||||||
|
|
||||||
# Choose what kind of storage to use for this uploader:
|
# Choose what kind of storage to use for this uploader:
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
class AttestationTemplateSignatureUploader < BaseUploader
|
class AttestationTemplateSignatureUploader < BaseUploader
|
||||||
def root
|
def root
|
||||||
File.join(Rails.root, 'public')
|
Rails.root.join("public")
|
||||||
end
|
end
|
||||||
|
|
||||||
# Choose what kind of storage to use for this uploader:
|
# Choose what kind of storage to use for this uploader:
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
class AttestationUploader < BaseUploader
|
class AttestationUploader < BaseUploader
|
||||||
def root
|
def root
|
||||||
File.join(Rails.root, 'public')
|
Rails.root.join("public")
|
||||||
end
|
end
|
||||||
|
|
||||||
# Choose what kind of storage to use for this uploader:
|
# Choose what kind of storage to use for this uploader:
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
class CommentaireFileUploader < BaseUploader
|
class CommentaireFileUploader < BaseUploader
|
||||||
def root
|
def root
|
||||||
File.join(Rails.root, 'public')
|
Rails.root.join("public")
|
||||||
end
|
end
|
||||||
|
|
||||||
if Features.remote_storage
|
if Features.remote_storage
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
require 'securerandom'
|
require 'securerandom'
|
||||||
|
|
||||||
class LocalDownloader
|
class LocalDownloader
|
||||||
BASE_PATH_DISK = File.join(Rails.root, "public/downloads/")
|
BASE_PATH_DISK = Rails.root.join("public", "downloads")
|
||||||
|
|
||||||
def initialize(filename, filename_suffix = '')
|
def initialize(filename, filename_suffix = '')
|
||||||
@filename = filename.to_s
|
@filename = filename.to_s
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
class ProcedureLogoUploader < BaseUploader
|
class ProcedureLogoUploader < BaseUploader
|
||||||
def root
|
def root
|
||||||
File.join(Rails.root, "public")
|
Rails.root.join("public")
|
||||||
end
|
end
|
||||||
|
|
||||||
# Choose what kind of storage to use for this uploader:
|
# Choose what kind of storage to use for this uploader:
|
||||||
|
|
|
@ -2,7 +2,7 @@ Apipie.configure do |config|
|
||||||
config.app_name = "API demarches-simplifiees.fr"
|
config.app_name = "API demarches-simplifiees.fr"
|
||||||
config.api_base_url = "/api/v1"
|
config.api_base_url = "/api/v1"
|
||||||
config.doc_base_url = "/docs"
|
config.doc_base_url = "/docs"
|
||||||
config.api_controllers_matcher = File.join(Rails.root, "app", "controllers","api","v1", "**","*.rb")
|
config.api_controllers_matcher = Rails.root.join("app", "controllers"," api", "v1", "**", "*.rb")
|
||||||
config.markup = Apipie::Markup::Markdown.new
|
config.markup = Apipie::Markup::Markdown.new
|
||||||
config.default_version = '1.0'
|
config.default_version = '1.0'
|
||||||
config.validate = false
|
config.validate = false
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
require_relative 'features'
|
require_relative 'features'
|
||||||
|
|
||||||
if Rails.env.test?
|
if Rails.env.test?
|
||||||
Fog.credentials_path = Rails.root.join('config/fog_credentials.test.yml')
|
Fog.credentials_path = Rails.root.join('config', 'fog_credentials.test.yml')
|
||||||
else
|
else
|
||||||
Fog.credentials_path = Rails.root.join('config/fog_credentials.yml')
|
Fog.credentials_path = Rails.root.join('config', 'fog_credentials.yml')
|
||||||
end
|
end
|
||||||
|
|
||||||
CarrierWave.configure do |config|
|
CarrierWave.configure do |config|
|
||||||
|
@ -20,7 +20,7 @@ CarrierWave.configure do |config|
|
||||||
# they will not be available for public (non-authenticated) downloading
|
# they will not be available for public (non-authenticated) downloading
|
||||||
config.root = Rails.root
|
config.root = Rails.root
|
||||||
|
|
||||||
config.cache_dir = "#{Rails.root}/uploads"
|
config.cache_dir = Rails.root.join("uploads")
|
||||||
|
|
||||||
config.fog_public = true
|
config.fog_public = true
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ FRANCE_CONNECT = if Rails.env.test?
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
fc_config_file_path = "#{Rails.root}/config/france_connect.yml"
|
fc_config_file_path = Rails.root.join("config", "france_connect.yml")
|
||||||
|
|
||||||
# FIXME: with a yaml with a { particulier: {} } structure
|
# FIXME: with a yaml with a { particulier: {} } structure
|
||||||
config_hash = YAML.safe_load(File.read(fc_config_file_path))
|
config_hash = YAML.safe_load(File.read(fc_config_file_path))
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
class UpdateModuleAPICarto < ActiveRecord::Migration
|
class UpdateModuleAPICarto < ActiveRecord::Migration
|
||||||
class Procedure < ActiveRecord::Base
|
class Procedure < ApplicationRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
class ModuleAPICarto < ActiveRecord::Base
|
class ModuleAPICarto < ApplicationRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
def up
|
def up
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
class CreateFranceConnectInformation < ActiveRecord::Migration
|
class CreateFranceConnectInformation < ActiveRecord::Migration
|
||||||
class User < ActiveRecord::Base
|
class User < ApplicationRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
class FranceConnectInformation < ActiveRecord::Base
|
class FranceConnectInformation < ApplicationRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
def up
|
def up
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
class DBremovePieceJustificativeEmpty < ActiveRecord::Migration
|
class DBremovePieceJustificativeEmpty < ActiveRecord::Migration
|
||||||
class PieceJustificative < ActiveRecord::Base
|
class PieceJustificative < ApplicationRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
def change
|
def change
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
class PieceJustificativeHaveUser < ActiveRecord::Migration
|
class PieceJustificativeHaveUser < ActiveRecord::Migration
|
||||||
class PieceJustificative < ActiveRecord::Base
|
class PieceJustificative < ApplicationRecord
|
||||||
belongs_to :dossier
|
belongs_to :dossier
|
||||||
end
|
end
|
||||||
|
|
||||||
class Dossier < ActiveRecord::Base
|
class Dossier < ApplicationRecord
|
||||||
belongs_to :user
|
belongs_to :user
|
||||||
end
|
end
|
||||||
|
|
||||||
class User < ActiveRecord::Base
|
class User < ApplicationRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
def change
|
def change
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
class CerfaHaveUser < ActiveRecord::Migration
|
class CerfaHaveUser < ActiveRecord::Migration
|
||||||
class Cerfa < ActiveRecord::Base
|
class Cerfa < ApplicationRecord
|
||||||
belongs_to :dossier
|
belongs_to :dossier
|
||||||
end
|
end
|
||||||
|
|
||||||
class Dossier < ActiveRecord::Base
|
class Dossier < ApplicationRecord
|
||||||
belongs_to :user
|
belongs_to :user
|
||||||
end
|
end
|
||||||
|
|
||||||
class User < ActiveRecord::Base
|
class User < ApplicationRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
def change
|
def change
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
class AdminHasAndBelongGestionnaire < ActiveRecord::Migration
|
class AdminHasAndBelongGestionnaire < ActiveRecord::Migration
|
||||||
class Gestionnaire < ActiveRecord::Base
|
class Gestionnaire < ApplicationRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
class AdministrateursGestionnaire < ActiveRecord::Base
|
class AdministrateursGestionnaire < ApplicationRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
def up
|
def up
|
||||||
|
|
|
@ -1,20 +1,20 @@
|
||||||
class GestionnaireIsAssignToProcedure < ActiveRecord::Migration
|
class GestionnaireIsAssignToProcedure < ActiveRecord::Migration
|
||||||
class AssignTo < ActiveRecord::Base
|
class AssignTo < ApplicationRecord
|
||||||
belongs_to :gestionnaire
|
belongs_to :gestionnaire
|
||||||
belongs_to :procedure
|
belongs_to :procedure
|
||||||
end
|
end
|
||||||
|
|
||||||
class Gestionnaire < ActiveRecord::Base
|
class Gestionnaire < ApplicationRecord
|
||||||
has_and_belongs_to_many :administrateurs
|
has_and_belongs_to_many :administrateurs
|
||||||
has_many :procedures, through: :assign_to
|
has_many :procedures, through: :assign_to
|
||||||
end
|
end
|
||||||
|
|
||||||
class Administrateur < ActiveRecord::Base
|
class Administrateur < ApplicationRecord
|
||||||
has_and_belongs_to_many :gestionnaires
|
has_and_belongs_to_many :gestionnaires
|
||||||
has_many :procedures
|
has_many :procedures
|
||||||
end
|
end
|
||||||
|
|
||||||
class Procedure < ActiveRecord::Base
|
class Procedure < ApplicationRecord
|
||||||
belongs_to :administrateur
|
belongs_to :administrateur
|
||||||
has_many :gestionnaires, through: :assign_to
|
has_many :gestionnaires, through: :assign_to
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
class SetOriginalFilenameForUploaders < ActiveRecord::Migration
|
class SetOriginalFilenameForUploaders < ActiveRecord::Migration
|
||||||
class PieceJustificative < ActiveRecord::Base
|
class PieceJustificative < ApplicationRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
class Cerfa < ActiveRecord::Base
|
class Cerfa < ApplicationRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
def change
|
def change
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
class AddProcedureStatus < ActiveRecord::Migration
|
class AddProcedureStatus < ActiveRecord::Migration
|
||||||
class Procedure < ActiveRecord::Base
|
class Procedure < ApplicationRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
def change
|
def change
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
class DeleteDefaultDescriptionToDossier < ActiveRecord::Migration
|
class DeleteDefaultDescriptionToDossier < ActiveRecord::Migration
|
||||||
class Dossier < ActiveRecord::Base
|
class Dossier < ApplicationRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
class Champ < ActiveRecord::Base
|
class Champ < ApplicationRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
class Procedure < ActiveRecord::Base
|
class Procedure < ApplicationRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
class TypeDeChamp < ActiveRecord::Base
|
class TypeDeChamp < ApplicationRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
def up
|
def up
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
class ConvertAllDatetimeToDateOnDatabase < ActiveRecord::Migration
|
class ConvertAllDatetimeToDateOnDatabase < ActiveRecord::Migration
|
||||||
class TypeDeChamp < ActiveRecord::Base
|
class TypeDeChamp < ApplicationRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
def change
|
def change
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
class AddProcedurePathMappingTable < ActiveRecord::Migration
|
class AddProcedurePathMappingTable < ActiveRecord::Migration
|
||||||
class ProcedurePath < ActiveRecord::Base
|
class ProcedurePath < ApplicationRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
def change
|
def change
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
class BuildDefaultPreferenceListDossier < ActiveRecord::Migration
|
class BuildDefaultPreferenceListDossier < ActiveRecord::Migration
|
||||||
class Gestionnaire < ActiveRecord::Base
|
class Gestionnaire < ApplicationRecord
|
||||||
def build_default_preferences_list_dossier
|
def build_default_preferences_list_dossier
|
||||||
PreferenceListDossier.available_columns.each do |table|
|
PreferenceListDossier.available_columns.each do |table|
|
||||||
table.second.each do |column|
|
table.second.each do |column|
|
||||||
|
@ -47,7 +47,7 @@ class BuildDefaultPreferenceListDossier < ActiveRecord::Migration
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class PreferenceListDossier < ActiveRecord::Base
|
class PreferenceListDossier < ApplicationRecord
|
||||||
def self.available_columns
|
def self.available_columns
|
||||||
{
|
{
|
||||||
dossier: columns_dossier,
|
dossier: columns_dossier,
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
class FixDefaultTypeOnTypeDeChampTable < ActiveRecord::Migration
|
class FixDefaultTypeOnTypeDeChampTable < ActiveRecord::Migration
|
||||||
class TypeDeChamp < ActiveRecord::Base
|
class TypeDeChamp < ApplicationRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
def up
|
def up
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
class AddTypeAttrInChampTable < ActiveRecord::Migration
|
class AddTypeAttrInChampTable < ActiveRecord::Migration
|
||||||
class TypeDeChamp < ActiveRecord::Base
|
class TypeDeChamp < ApplicationRecord
|
||||||
has_many :champs
|
has_many :champs
|
||||||
end
|
end
|
||||||
|
|
||||||
class Champ < ActiveRecord::Base
|
class Champ < ApplicationRecord
|
||||||
belongs_to :type_de_champ
|
belongs_to :type_de_champ
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
class DeleteValueOfFilterProcedure < ActiveRecord::Migration
|
class DeleteValueOfFilterProcedure < ActiveRecord::Migration
|
||||||
class Gestionnaire < ActiveRecord::Base
|
class Gestionnaire < ApplicationRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
def change
|
def change
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
class InitiatedAllReceivedMailForProcedure < ActiveRecord::Migration
|
class InitiatedAllReceivedMailForProcedure < ActiveRecord::Migration
|
||||||
class Procedure < ActiveRecord::Base
|
class Procedure < ApplicationRecord
|
||||||
has_one :mail_received
|
has_one :mail_received
|
||||||
end
|
end
|
||||||
|
|
||||||
class MailTemplate < ActiveRecord::Base
|
class MailTemplate < ApplicationRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
class ::MailReceived < MailTemplate
|
class ::MailReceived < MailTemplate
|
||||||
|
|
|
@ -1,21 +1,21 @@
|
||||||
class BuildDefaultPrefListDossierProcedure < ActiveRecord::Migration
|
class BuildDefaultPrefListDossierProcedure < ActiveRecord::Migration
|
||||||
class Gestionnaire < ActiveRecord::Base
|
class Gestionnaire < ApplicationRecord
|
||||||
has_many :assign_to, dependent: :destroy
|
has_many :assign_to, dependent: :destroy
|
||||||
has_many :procedures, through: :assign_to
|
has_many :procedures, through: :assign_to
|
||||||
has_many :preference_list_dossiers
|
has_many :preference_list_dossiers
|
||||||
end
|
end
|
||||||
|
|
||||||
class PreferenceListDossier < ActiveRecord::Base
|
class PreferenceListDossier < ApplicationRecord
|
||||||
belongs_to :gestionnaire
|
belongs_to :gestionnaire
|
||||||
belongs_to :procedure
|
belongs_to :procedure
|
||||||
end
|
end
|
||||||
|
|
||||||
class AssignTo < ActiveRecord::Base
|
class AssignTo < ApplicationRecord
|
||||||
belongs_to :procedure
|
belongs_to :procedure
|
||||||
belongs_to :gestionnaire
|
belongs_to :gestionnaire
|
||||||
end
|
end
|
||||||
|
|
||||||
class Procedure < ActiveRecord::Base
|
class Procedure < ApplicationRecord
|
||||||
has_many :gestionnaires, through: :assign_to
|
has_many :gestionnaires, through: :assign_to
|
||||||
has_many :preference_list_dossiers
|
has_many :preference_list_dossiers
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
class ChangeEmptytoNilInPreferenceListDossierTable < ActiveRecord::Migration
|
class ChangeEmptytoNilInPreferenceListDossierTable < ActiveRecord::Migration
|
||||||
class PreferenceListDossier < ActiveRecord::Base
|
class PreferenceListDossier < ApplicationRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
def change
|
def change
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
class FixTypeDeChampHeaderSectionWithMandatoryTrue < ActiveRecord::Migration
|
class FixTypeDeChampHeaderSectionWithMandatoryTrue < ActiveRecord::Migration
|
||||||
class TypeDeChamp < ActiveRecord::Base
|
class TypeDeChamp < ApplicationRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
def change
|
def change
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
class PurgeDraftDossier < ActiveRecord::Migration
|
class PurgeDraftDossier < ActiveRecord::Migration
|
||||||
class Dossier < ActiveRecord::Base
|
class Dossier < ApplicationRecord
|
||||||
BROUILLON = %w(draft)
|
BROUILLON = %w(draft)
|
||||||
|
|
||||||
def brouillon?
|
def brouillon?
|
||||||
|
@ -7,11 +7,11 @@ class PurgeDraftDossier < ActiveRecord::Migration
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class Commentaire < ActiveRecord::Base
|
class Commentaire < ApplicationRecord
|
||||||
belongs_to :dossier
|
belongs_to :dossier
|
||||||
end
|
end
|
||||||
|
|
||||||
class Cerfa < ActiveRecord::Base
|
class Cerfa < ApplicationRecord
|
||||||
belongs_to :dossier
|
belongs_to :dossier
|
||||||
belongs_to :user
|
belongs_to :user
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
class ResetAllPreferenceListDossier < ActiveRecord::Migration
|
class ResetAllPreferenceListDossier < ActiveRecord::Migration
|
||||||
class PreferenceListDossier < ActiveRecord::Base
|
class PreferenceListDossier < ApplicationRecord
|
||||||
belongs_to :gestionnaire
|
belongs_to :gestionnaire
|
||||||
belongs_to :procedure
|
belongs_to :procedure
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@ class ResetAllPreferenceListDossier < ActiveRecord::Migration
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class Gestionnaire < ActiveRecord::Base
|
class Gestionnaire < ApplicationRecord
|
||||||
has_many :assign_to, dependent: :destroy
|
has_many :assign_to, dependent: :destroy
|
||||||
has_many :procedures, through: :assign_to
|
has_many :procedures, through: :assign_to
|
||||||
|
|
||||||
|
@ -145,7 +145,7 @@ class ResetAllPreferenceListDossier < ActiveRecord::Migration
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class Procedure < ActiveRecord::Base
|
class Procedure < ApplicationRecord
|
||||||
has_many :assign_to, dependent: :destroy
|
has_many :assign_to, dependent: :destroy
|
||||||
has_many :gestionnaires, through: :assign_to
|
has_many :gestionnaires, through: :assign_to
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
class CreatePreferenceSmartListingPage < ActiveRecord::Migration
|
class CreatePreferenceSmartListingPage < ActiveRecord::Migration
|
||||||
class Gestionnaire < ActiveRecord::Base
|
class Gestionnaire < ApplicationRecord
|
||||||
has_one :preference_smart_listing_page, dependent: :destroy
|
has_one :preference_smart_listing_page, dependent: :destroy
|
||||||
|
|
||||||
def build_default_preferences_smart_listing_page
|
def build_default_preferences_smart_listing_page
|
||||||
|
@ -7,7 +7,7 @@ class CreatePreferenceSmartListingPage < ActiveRecord::Migration
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class PreferenceSmartListingPage < ActiveRecord::Base
|
class PreferenceSmartListingPage < ApplicationRecord
|
||||||
belongs_to :gestionnaire
|
belongs_to :gestionnaire
|
||||||
belongs_to :procedure
|
belongs_to :procedure
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ namespace :'2017_07_26_clean_birthdate_on_individual' do
|
||||||
puts "cleaning #{i.birthdate}"
|
puts "cleaning #{i.birthdate}"
|
||||||
new_date = Date.strptime(i.birthdate, "%d/%m/%y")
|
new_date = Date.strptime(i.birthdate, "%d/%m/%y")
|
||||||
if new_date.year > 2017
|
if new_date.year > 2017
|
||||||
new_date = new_date - 100.year
|
new_date = new_date - 100.years
|
||||||
end
|
end
|
||||||
i.update(birthdate: new_date.iso8601)
|
i.update(birthdate: new_date.iso8601)
|
||||||
end
|
end
|
||||||
|
|
|
@ -41,7 +41,7 @@ namespace :'2017_10_30_copy_commentaire_piece_justificative_to_file' do
|
||||||
end
|
end
|
||||||
|
|
||||||
commentaire.save
|
commentaire.save
|
||||||
if !commentaire.file.present?
|
if commentaire.file.blank?
|
||||||
puts "Failed to save file for commentaire #{commentaire.id}"
|
puts "Failed to save file for commentaire #{commentaire.id}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -105,7 +105,7 @@ namespace :cloudstorage do
|
||||||
|
|
||||||
@cont.objects_detail.each { |object, details|
|
@cont.objects_detail.each { |object, details|
|
||||||
last_modified = DateTime.parse(details[:last_modified])
|
last_modified = DateTime.parse(details[:last_modified])
|
||||||
@cont.delete_object(object) if last_modified.utc <= (Time.now - 2.year).utc
|
@cont.delete_object(object) if last_modified.utc <= (Time.now - 2.years).utc
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -112,7 +112,7 @@ describe Admin::GestionnairesController, type: :controller do
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when an other admin will add the same email' do
|
context 'when an other admin will add the same email' do
|
||||||
let(:gestionnaire) { Gestionnaire.find_by_email(email) }
|
let(:gestionnaire) { Gestionnaire.find_by(email: email) }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
create :gestionnaire, email: email, administrateurs: [admin]
|
create :gestionnaire, email: email, administrateurs: [admin]
|
||||||
|
@ -133,7 +133,7 @@ describe Admin::GestionnairesController, type: :controller do
|
||||||
|
|
||||||
context 'when an other admin will add the same email with some uppercase in it' do
|
context 'when an other admin will add the same email with some uppercase in it' do
|
||||||
let(:email) { 'Test@Plop.com' }
|
let(:email) { 'Test@Plop.com' }
|
||||||
let(:gestionnaire) { Gestionnaire.find_by_email(email.downcase) }
|
let(:gestionnaire) { Gestionnaire.find_by(email: email.downcase) }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
create :gestionnaire, email: email, administrateurs: [admin]
|
create :gestionnaire, email: email, administrateurs: [admin]
|
||||||
|
|
|
@ -254,9 +254,9 @@ describe NewGestionnaire::ProceduresController, type: :controller do
|
||||||
|
|
||||||
describe 'statut' do
|
describe 'statut' do
|
||||||
let!(:a_suivre__dossier) { Timecop.freeze(1.day.ago){ create(:dossier, procedure: procedure, state: 'en_instruction') } }
|
let!(:a_suivre__dossier) { Timecop.freeze(1.day.ago){ create(:dossier, procedure: procedure, state: 'en_instruction') } }
|
||||||
let!(:new_followed_dossier) { Timecop.freeze(2.day.ago){ create(:dossier, procedure: procedure, state: 'en_instruction') } }
|
let!(:new_followed_dossier) { Timecop.freeze(2.days.ago){ create(:dossier, procedure: procedure, state: 'en_instruction') } }
|
||||||
let!(:termine_dossier) { Timecop.freeze(3.day.ago){ create(:dossier, procedure: procedure, state: 'accepte') } }
|
let!(:termine_dossier) { Timecop.freeze(3.days.ago){ create(:dossier, procedure: procedure, state: 'accepte') } }
|
||||||
let!(:archived_dossier) { Timecop.freeze(4.day.ago){ create(:dossier, procedure: procedure, state: 'en_instruction', archived: true) } }
|
let!(:archived_dossier) { Timecop.freeze(4.days.ago){ create(:dossier, procedure: procedure, state: 'en_instruction', archived: true) } }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
gestionnaire.followed_dossiers << new_followed_dossier
|
gestionnaire.followed_dossiers << new_followed_dossier
|
||||||
|
|
|
@ -45,7 +45,7 @@ describe StatsController, type: :controller do
|
||||||
it do
|
it do
|
||||||
expect(subject).to eq([
|
expect(subject).to eq([
|
||||||
[I18n.l(45.days.ago.beginning_of_month, format: "%B %Y"), 1],
|
[I18n.l(45.days.ago.beginning_of_month, format: "%B %Y"), 1],
|
||||||
[I18n.l(1.days.ago.beginning_of_month, format: "%B %Y"), 2]
|
[I18n.l(1.day.ago.beginning_of_month, format: "%B %Y"), 2]
|
||||||
])
|
])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -72,7 +72,7 @@ describe StatsController, type: :controller do
|
||||||
|
|
||||||
it do
|
it do
|
||||||
expect(subject).to eq({
|
expect(subject).to eq({
|
||||||
2.month.ago.beginning_of_month => 2,
|
2.months.ago.beginning_of_month => 2,
|
||||||
1.month.ago.beginning_of_month => 4,
|
1.month.ago.beginning_of_month => 4,
|
||||||
1.hour.ago.beginning_of_month => 5
|
1.hour.ago.beginning_of_month => 5
|
||||||
})
|
})
|
||||||
|
@ -86,7 +86,7 @@ describe StatsController, type: :controller do
|
||||||
|
|
||||||
it do
|
it do
|
||||||
expect(subject).to eq({
|
expect(subject).to eq({
|
||||||
2.month.ago.beginning_of_month => 2,
|
2.months.ago.beginning_of_month => 2,
|
||||||
1.month.ago.beginning_of_month => 4
|
1.month.ago.beginning_of_month => 4
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
@ -151,22 +151,22 @@ describe StatsController, type: :controller do
|
||||||
dossier_p1_b = FactoryBot.create(:dossier,
|
dossier_p1_b = FactoryBot.create(:dossier,
|
||||||
:procedure => procedure_1,
|
:procedure => procedure_1,
|
||||||
:en_construction_at => 2.months.ago.beginning_of_month,
|
:en_construction_at => 2.months.ago.beginning_of_month,
|
||||||
:processed_at => 2.months.ago.beginning_of_month + 1.days)
|
:processed_at => 2.months.ago.beginning_of_month + 1.day)
|
||||||
dossier_p1_c = FactoryBot.create(:dossier,
|
dossier_p1_c = FactoryBot.create(:dossier,
|
||||||
:procedure => procedure_1,
|
:procedure => procedure_1,
|
||||||
:en_construction_at => 1.months.ago.beginning_of_month,
|
:en_construction_at => 1.month.ago.beginning_of_month,
|
||||||
:processed_at => 1.months.ago.beginning_of_month + 5.days)
|
:processed_at => 1.month.ago.beginning_of_month + 5.days)
|
||||||
dossier_p2_a = FactoryBot.create(:dossier,
|
dossier_p2_a = FactoryBot.create(:dossier,
|
||||||
:procedure => procedure_2,
|
:procedure => procedure_2,
|
||||||
:en_construction_at => 2.month.ago.beginning_of_month,
|
:en_construction_at => 2.months.ago.beginning_of_month,
|
||||||
:processed_at => 2.month.ago.beginning_of_month + 4.days)
|
:processed_at => 2.months.ago.beginning_of_month + 4.days)
|
||||||
|
|
||||||
# Write directly in the DB to avoid the before_validation hook
|
# Write directly in the DB to avoid the before_validation hook
|
||||||
Dossier.update_all(state: "accepte")
|
Dossier.update_all(state: "accepte")
|
||||||
|
|
||||||
@expected_hash = {
|
@expected_hash = {
|
||||||
"#{2.months.ago.beginning_of_month}" => 3.0,
|
"#{2.months.ago.beginning_of_month}" => 3.0,
|
||||||
"#{1.months.ago.beginning_of_month}" => 5.0
|
"#{1.month.ago.beginning_of_month}" => 5.0
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -204,21 +204,21 @@ describe StatsController, type: :controller do
|
||||||
:processed_at => 2.months.ago.beginning_of_month + 1.day)
|
:processed_at => 2.months.ago.beginning_of_month + 1.day)
|
||||||
dossier_p1_c = FactoryBot.create(:dossier,
|
dossier_p1_c = FactoryBot.create(:dossier,
|
||||||
:procedure => procedure_1,
|
:procedure => procedure_1,
|
||||||
:created_at => 1.months.ago.beginning_of_month,
|
:created_at => 1.month.ago.beginning_of_month,
|
||||||
:en_construction_at => 1.months.ago.beginning_of_month + 50.minutes,
|
:en_construction_at => 1.month.ago.beginning_of_month + 50.minutes,
|
||||||
:processed_at => 1.months.ago.beginning_of_month + 1.day)
|
:processed_at => 1.month.ago.beginning_of_month + 1.day)
|
||||||
dossier_p2_a = FactoryBot.create(:dossier,
|
dossier_p2_a = FactoryBot.create(:dossier,
|
||||||
:procedure => procedure_2,
|
:procedure => procedure_2,
|
||||||
:created_at => 2.month.ago.beginning_of_month,
|
:created_at => 2.months.ago.beginning_of_month,
|
||||||
:en_construction_at => 2.month.ago.beginning_of_month + 80.minutes,
|
:en_construction_at => 2.months.ago.beginning_of_month + 80.minutes,
|
||||||
:processed_at => 2.month.ago.beginning_of_month + 1.day)
|
:processed_at => 2.months.ago.beginning_of_month + 1.day)
|
||||||
|
|
||||||
# Write directly in the DB to avoid the before_validation hook
|
# Write directly in the DB to avoid the before_validation hook
|
||||||
Dossier.update_all(state: "accepte")
|
Dossier.update_all(state: "accepte")
|
||||||
|
|
||||||
@expected_hash = {
|
@expected_hash = {
|
||||||
"#{2.months.ago.beginning_of_month}" => 30.0,
|
"#{2.months.ago.beginning_of_month}" => 30.0,
|
||||||
"#{1.months.ago.beginning_of_month}" => 50.0
|
"#{1.month.ago.beginning_of_month}" => 50.0
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -239,7 +239,7 @@ describe StatsController, type: :controller do
|
||||||
|
|
||||||
subject { StatsController.new.send(:avis_usage) }
|
subject { StatsController.new.send(:avis_usage) }
|
||||||
|
|
||||||
it { expect(subject).to match([[3.week.ago.to_i, 0], [2.week.ago.to_i, 0], [1.week.ago.to_i, 33.33]]) }
|
it { expect(subject).to match([[3.weeks.ago.to_i, 0], [2.weeks.ago.to_i, 0], [1.week.ago.to_i, 33.33]]) }
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "#avis_average_answer_time" do
|
describe "#avis_average_answer_time" do
|
||||||
|
@ -251,10 +251,10 @@ describe StatsController, type: :controller do
|
||||||
create(:avis, created_at: 1.week.ago + 2.days)
|
create(:avis, created_at: 1.week.ago + 2.days)
|
||||||
|
|
||||||
# 2 weeks ago
|
# 2 weeks ago
|
||||||
create(:avis, answer: "voila ma réponse", created_at: 2.week.ago + 1.day, updated_at: 2.week.ago + 2.days) # 1 day
|
create(:avis, answer: "voila ma réponse", created_at: 2.weeks.ago + 1.day, updated_at: 2.weeks.ago + 2.days) # 1 day
|
||||||
create(:avis, answer: "voila ma réponse2", created_at: 2.week.ago + 3.days, updated_at: 1.week.ago + 6.days) # 10 days
|
create(:avis, answer: "voila ma réponse2", created_at: 2.weeks.ago + 3.days, updated_at: 1.week.ago + 6.days) # 10 days
|
||||||
create(:avis, answer: "voila ma réponse2", created_at: 2.week.ago + 2.days, updated_at: 1.week.ago + 6.days) # 11 days
|
create(:avis, answer: "voila ma réponse2", created_at: 2.weeks.ago + 2.days, updated_at: 1.week.ago + 6.days) # 11 days
|
||||||
create(:avis, created_at: 2.week.ago + 1.day, updated_at: 2.week.ago + 2.days)
|
create(:avis, created_at: 2.weeks.ago + 1.day, updated_at: 2.weeks.ago + 2.days)
|
||||||
|
|
||||||
# 3 weeks ago
|
# 3 weeks ago
|
||||||
create(:avis, answer: "voila ma réponse2", created_at: 3.weeks.ago + 1.day, updated_at: 3.weeks.ago + 2.days) # 1 day
|
create(:avis, answer: "voila ma réponse2", created_at: 3.weeks.ago + 1.day, updated_at: 3.weeks.ago + 2.days) # 1 day
|
||||||
|
@ -267,8 +267,8 @@ describe StatsController, type: :controller do
|
||||||
|
|
||||||
it { expect(subject.count).to eq(3) }
|
it { expect(subject.count).to eq(3) }
|
||||||
it { is_expected.to include [1.week.ago.to_i, 1.0] }
|
it { is_expected.to include [1.week.ago.to_i, 1.0] }
|
||||||
it { is_expected.to include [2.week.ago.to_i, 7.33] }
|
it { is_expected.to include [2.weeks.ago.to_i, 7.33] }
|
||||||
it { is_expected.to include [3.week.ago.to_i, 9.5] }
|
it { is_expected.to include [3.weeks.ago.to_i, 9.5] }
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '#avis_answer_percentages' do
|
describe '#avis_answer_percentages' do
|
||||||
|
@ -281,7 +281,7 @@ describe StatsController, type: :controller do
|
||||||
before { Timecop.freeze(Time.now) }
|
before { Timecop.freeze(Time.now) }
|
||||||
after { Timecop.return }
|
after { Timecop.return }
|
||||||
|
|
||||||
it { is_expected.to match [[3.week.ago.to_i, 0], [2.week.ago.to_i, 0], [1.week.ago.to_i, 66.67]] }
|
it { is_expected.to match [[3.weeks.ago.to_i, 0], [2.weeks.ago.to_i, 0], [1.week.ago.to_i, 66.67]] }
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '#motivation_usage_dossier' do
|
describe '#motivation_usage_dossier' do
|
||||||
|
@ -294,7 +294,7 @@ describe StatsController, type: :controller do
|
||||||
|
|
||||||
subject { StatsController.new.send(:motivation_usage_dossier) }
|
subject { StatsController.new.send(:motivation_usage_dossier) }
|
||||||
|
|
||||||
it { expect(subject).to match([[I18n.l(3.week.ago.end_of_week, format: '%d/%m/%Y'), 0], [I18n.l(2.week.ago.end_of_week, format: '%d/%m/%Y'), 0], [I18n.l(1.week.ago.end_of_week, format: '%d/%m/%Y'), 33.33]]) }
|
it { expect(subject).to match([[I18n.l(3.weeks.ago.end_of_week, format: '%d/%m/%Y'), 0], [I18n.l(2.weeks.ago.end_of_week, format: '%d/%m/%Y'), 0], [I18n.l(1.week.ago.end_of_week, format: '%d/%m/%Y'), 33.33]]) }
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '#motivation_usage_procedure' do
|
describe '#motivation_usage_procedure' do
|
||||||
|
@ -308,6 +308,6 @@ describe StatsController, type: :controller do
|
||||||
|
|
||||||
subject { StatsController.new.send(:motivation_usage_procedure) }
|
subject { StatsController.new.send(:motivation_usage_procedure) }
|
||||||
|
|
||||||
it { expect(subject).to match([[I18n.l(3.week.ago.end_of_week, format: '%d/%m/%Y'), 0], [I18n.l(2.week.ago.end_of_week, format: '%d/%m/%Y'), 0], [I18n.l(1.week.ago.end_of_week, format: '%d/%m/%Y'), 33.33]]) }
|
it { expect(subject).to match([[I18n.l(3.weeks.ago.end_of_week, format: '%d/%m/%Y'), 0], [I18n.l(2.weeks.ago.end_of_week, format: '%d/%m/%Y'), 0], [I18n.l(1.week.ago.end_of_week, format: '%d/%m/%Y'), 33.33]]) }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -376,7 +376,7 @@ shared_examples 'description_controller_spec' do
|
||||||
|
|
||||||
it { expect(dossier.pieces_justificatives.size).to eq 2 }
|
it { expect(dossier.pieces_justificatives.size).to eq 2 }
|
||||||
it { expect(flash[:notice]).to be_present }
|
it { expect(flash[:notice]).to be_present }
|
||||||
it { is_expected.to redirect_to users_dossiers_invite_path(id: guest.invites.find_by_dossier_id(dossier.id).id) }
|
it { is_expected.to redirect_to users_dossiers_invite_path(id: guest.invites.find_by(dossier_id: dossier.id).id) }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -396,7 +396,7 @@ shared_examples 'description_controller_spec' do
|
||||||
|
|
||||||
it { expect(dossier.pieces_justificatives.size).to eq 4 }
|
it { expect(dossier.pieces_justificatives.size).to eq 4 }
|
||||||
it { expect(flash[:notice]).to be_present }
|
it { expect(flash[:notice]).to be_present }
|
||||||
it { is_expected.to redirect_to users_dossiers_invite_path(id: guest.invites.find_by_dossier_id(dossier.id).id) }
|
it { is_expected.to redirect_to users_dossiers_invite_path(id: guest.invites.find_by(dossier_id: dossier.id).id) }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -413,7 +413,7 @@ shared_examples 'description_controller_spec' do
|
||||||
|
|
||||||
it { expect(dossier.pieces_justificatives.size).to eq 1 }
|
it { expect(dossier.pieces_justificatives.size).to eq 1 }
|
||||||
it { expect(flash[:alert]).to be_present }
|
it { expect(flash[:alert]).to be_present }
|
||||||
it { is_expected.to redirect_to users_dossiers_invite_path(id: guest.invites.find_by_dossier_id(dossier.id).id) }
|
it { is_expected.to redirect_to users_dossiers_invite_path(id: guest.invites.find_by(dossier_id: dossier.id).id) }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -85,7 +85,7 @@ FactoryBot.define do
|
||||||
after(:create) do |dossier, _evaluator|
|
after(:create) do |dossier, _evaluator|
|
||||||
dossier.state = 'en_instruction'
|
dossier.state = 'en_instruction'
|
||||||
dossier.en_construction_at = dossier.created_at + 1.minute
|
dossier.en_construction_at = dossier.created_at + 1.minute
|
||||||
dossier.created_at = dossier.created_at + 2.minute
|
dossier.created_at = dossier.created_at + 2.minutes
|
||||||
dossier.save!
|
dossier.save!
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -245,9 +245,9 @@ describe Procedure do
|
||||||
|
|
||||||
it { expect(procedure.archived_at).to eq(nil) }
|
it { expect(procedure.archived_at).to eq(nil) }
|
||||||
it { expect(procedure.published_at).to eq(now) }
|
it { expect(procedure.published_at).to eq(now) }
|
||||||
it { expect(ProcedurePath.find_by_path("example-path")).to be }
|
it { expect(ProcedurePath.find_by(path: "example-path")).to be }
|
||||||
it { expect(ProcedurePath.find_by_path("example-path").procedure).to eq(procedure) }
|
it { expect(ProcedurePath.find_by(path: "example-path").procedure).to eq(procedure) }
|
||||||
it { expect(ProcedurePath.find_by_path("example-path").administrateur).to eq(procedure.administrateur) }
|
it { expect(ProcedurePath.find_by(path: "example-path").administrateur).to eq(procedure.administrateur) }
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "#brouillon?" do
|
describe "#brouillon?" do
|
||||||
|
|
|
@ -52,8 +52,8 @@ Capybara.default_max_wait_time = 1
|
||||||
|
|
||||||
# Requires supporting ruby files with custom matchers and macros, etc,
|
# Requires supporting ruby files with custom matchers and macros, etc,
|
||||||
# in spec/support/ and its subdirectories.
|
# in spec/support/ and its subdirectories.
|
||||||
Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f }
|
Dir[Rails.root.join('spec', 'support', '**', '*.rb')].each { |f| require f }
|
||||||
Dir[Rails.root.join('spec/factories/**/*.rb')].each { |f| require f }
|
Dir[Rails.root.join('spec', 'factories', '**', '*.rb')].each { |f| require f }
|
||||||
|
|
||||||
# Checks for pending migrations before tests are run.
|
# Checks for pending migrations before tests are run.
|
||||||
# If you are not using ActiveRecord, you can remove this line.
|
# If you are not using ActiveRecord, you can remove this line.
|
||||||
|
|
Loading…
Reference in a new issue