Bump development gems
- brakeman - rubocop - scss_lint
This commit is contained in:
parent
51988b7ccd
commit
e26f4148ff
42 changed files with 99 additions and 94 deletions
40
.rubocop.yml
40
.rubocop.yml
|
@ -24,6 +24,9 @@ Layout/AlignParameters:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
EnforcedStyle: with_fixed_indentation
|
EnforcedStyle: with_fixed_indentation
|
||||||
|
|
||||||
|
Layout/BlockAlignment:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
Layout/BlockEndNewline:
|
Layout/BlockEndNewline:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
|
||||||
|
@ -37,6 +40,12 @@ Layout/ClosingParenthesisIndentation:
|
||||||
Layout/CommentIndentation:
|
Layout/CommentIndentation:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
|
||||||
|
Layout/ConditionPosition:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Layout/DefEndAlignment:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
Layout/DotPosition:
|
Layout/DotPosition:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
|
||||||
|
@ -73,6 +82,10 @@ Layout/EmptyLinesAroundMethodBody:
|
||||||
Layout/EmptyLinesAroundModuleBody:
|
Layout/EmptyLinesAroundModuleBody:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
|
||||||
|
Layout/EndAlignment:
|
||||||
|
Enabled: true
|
||||||
|
EnforcedStyleAlignWith: variable
|
||||||
|
|
||||||
Layout/EndOfLine:
|
Layout/EndOfLine:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
EnforcedStyle: lf
|
EnforcedStyle: lf
|
||||||
|
@ -248,21 +261,12 @@ Lint/AmbiguousRegexpLiteral:
|
||||||
Lint/AssignmentInCondition:
|
Lint/AssignmentInCondition:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
Lint/BlockAlignment:
|
|
||||||
Enabled: false
|
|
||||||
|
|
||||||
Lint/CircularArgumentReference:
|
Lint/CircularArgumentReference:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
Lint/ConditionPosition:
|
|
||||||
Enabled: false
|
|
||||||
|
|
||||||
Lint/Debugger:
|
Lint/Debugger:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
Lint/DefEndAlignment:
|
|
||||||
Enabled: false
|
|
||||||
|
|
||||||
Lint/DeprecatedClassMethods:
|
Lint/DeprecatedClassMethods:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
|
@ -293,10 +297,6 @@ Lint/EmptyInterpolation:
|
||||||
Lint/EmptyWhen:
|
Lint/EmptyWhen:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
Lint/EndAlignment:
|
|
||||||
Enabled: true
|
|
||||||
EnforcedStyleAlignWith: variable
|
|
||||||
|
|
||||||
Lint/EndInMethod:
|
Lint/EndInMethod:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
|
@ -480,12 +480,18 @@ Naming/FileName:
|
||||||
Naming/HeredocDelimiterNaming:
|
Naming/HeredocDelimiterNaming:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
|
Naming/MemoizedInstanceVariableName:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
Naming/MethodName:
|
Naming/MethodName:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
Naming/PredicateName:
|
Naming/PredicateName:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
|
Naming/UncommunicativeMethodParamName:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
Naming/VariableName:
|
Naming/VariableName:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
|
@ -522,9 +528,6 @@ Performance/FixedSize:
|
||||||
Performance/FlatMap:
|
Performance/FlatMap:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
|
||||||
Performance/HashEachMethods:
|
|
||||||
Enabled: false
|
|
||||||
|
|
||||||
Performance/LstripRstrip:
|
Performance/LstripRstrip:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
|
||||||
|
@ -1080,7 +1083,10 @@ Style/TernaryParentheses:
|
||||||
Style/TrailingCommaInArguments:
|
Style/TrailingCommaInArguments:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
Style/TrailingCommaInLiteral:
|
Style/TrailingCommaInArrayLiteral:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/TrailingCommaInHashLiteral:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
Style/TrailingUnderscoreVariable:
|
Style/TrailingUnderscoreVariable:
|
||||||
|
|
12
Gemfile.lock
12
Gemfile.lock
|
@ -115,7 +115,7 @@ GEM
|
||||||
sass (>= 3.3.4)
|
sass (>= 3.3.4)
|
||||||
bootstrap-wysihtml5-rails (0.3.3.8)
|
bootstrap-wysihtml5-rails (0.3.3.8)
|
||||||
railties (>= 3.0)
|
railties (>= 3.0)
|
||||||
brakeman (4.1.1)
|
brakeman (4.2.0)
|
||||||
browser (2.5.3)
|
browser (2.5.3)
|
||||||
builder (3.2.3)
|
builder (3.2.3)
|
||||||
byebug (10.0.0)
|
byebug (10.0.0)
|
||||||
|
@ -527,7 +527,7 @@ GEM
|
||||||
json
|
json
|
||||||
orm_adapter (0.5.0)
|
orm_adapter (0.5.0)
|
||||||
parallel (1.12.1)
|
parallel (1.12.1)
|
||||||
parser (2.5.0.1)
|
parser (2.5.0.3)
|
||||||
ast (~> 2.4.0)
|
ast (~> 2.4.0)
|
||||||
pdf-core (0.7.0)
|
pdf-core (0.7.0)
|
||||||
pg (0.19.0)
|
pg (0.19.0)
|
||||||
|
@ -642,9 +642,9 @@ GEM
|
||||||
rspec-support (3.7.1)
|
rspec-support (3.7.1)
|
||||||
rspec_junit_formatter (0.3.0)
|
rspec_junit_formatter (0.3.0)
|
||||||
rspec-core (>= 2, < 4, != 2.12.0)
|
rspec-core (>= 2, < 4, != 2.12.0)
|
||||||
rubocop (0.52.1)
|
rubocop (0.53.0)
|
||||||
parallel (~> 1.10)
|
parallel (~> 1.10)
|
||||||
parser (>= 2.4.0.2, < 3.0)
|
parser (>= 2.5)
|
||||||
powerpack (~> 0.1)
|
powerpack (~> 0.1)
|
||||||
rainbow (>= 2.2.2, < 4.0)
|
rainbow (>= 2.2.2, < 4.0)
|
||||||
ruby-progressbar (~> 1.7)
|
ruby-progressbar (~> 1.7)
|
||||||
|
@ -672,9 +672,9 @@ GEM
|
||||||
scenic (1.4.1)
|
scenic (1.4.1)
|
||||||
activerecord (>= 4.0.0)
|
activerecord (>= 4.0.0)
|
||||||
railties (>= 4.0.0)
|
railties (>= 4.0.0)
|
||||||
scss_lint (0.56.0)
|
scss_lint (0.57.0)
|
||||||
rake (>= 0.9, < 13)
|
rake (>= 0.9, < 13)
|
||||||
sass (~> 3.5.3)
|
sass (~> 3.5.5)
|
||||||
securecompare (1.0.0)
|
securecompare (1.0.0)
|
||||||
select2-rails (4.0.3)
|
select2-rails (4.0.3)
|
||||||
thor (~> 0.14)
|
thor (~> 0.14)
|
||||||
|
|
2
Rakefile
2
Rakefile
|
@ -1,7 +1,7 @@
|
||||||
# Add your own tasks in files placed in lib/tasks ending in .rake,
|
# Add your own tasks in files placed in lib/tasks ending in .rake,
|
||||||
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
||||||
|
|
||||||
require File.expand_path('../config/application', __FILE__)
|
require File.expand_path('config/application', __dir__)
|
||||||
|
|
||||||
Rails.application.load_tasks
|
Rails.application.load_tasks
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ class Admin::AttestationTemplatesController < AdminController
|
||||||
def update
|
def update
|
||||||
attestation_template = @procedure.attestation_template
|
attestation_template = @procedure.attestation_template
|
||||||
|
|
||||||
if attestation_template.update_attributes(activated_attestation_params)
|
if attestation_template.update(activated_attestation_params)
|
||||||
flash.notice = "L'attestation a bien été modifiée"
|
flash.notice = "L'attestation a bien été modifiée"
|
||||||
else
|
else
|
||||||
flash.alert = attestation_template.errors.full_messages.join('<br>')
|
flash.alert = attestation_template.errors.full_messages.join('<br>')
|
||||||
|
|
|
@ -11,7 +11,7 @@ class Admin::MailTemplatesController < AdminController
|
||||||
|
|
||||||
def update
|
def update
|
||||||
mail_template = find_mail_template_by_slug(params[:id])
|
mail_template = find_mail_template_by_slug(params[:id])
|
||||||
mail_template.update_attributes(update_params)
|
mail_template.update(update_params)
|
||||||
redirect_to admin_procedure_mail_templates_path
|
redirect_to admin_procedure_mail_templates_path
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ class Admin::PiecesJustificativesController < AdminController
|
||||||
end
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
if @procedure.update_attributes(update_params)
|
if @procedure.update(update_params)
|
||||||
flash.now.notice = 'Modifications sauvegardées'
|
flash.now.notice = 'Modifications sauvegardées'
|
||||||
else
|
else
|
||||||
flash.now.notice = 'Une erreur est survenue'
|
flash.now.notice = 'Une erreur est survenue'
|
||||||
|
|
|
@ -105,7 +105,7 @@ class Admin::ProceduresController < AdminController
|
||||||
def update
|
def update
|
||||||
@procedure = current_administrateur.procedures.find(params[:id])
|
@procedure = current_administrateur.procedures.find(params[:id])
|
||||||
|
|
||||||
if !@procedure.update_attributes(procedure_params)
|
if !@procedure.update(procedure_params)
|
||||||
flash.now.alert = @procedure.errors.full_messages
|
flash.now.alert = @procedure.errors.full_messages
|
||||||
return render 'edit'
|
return render 'edit'
|
||||||
end
|
end
|
||||||
|
|
|
@ -15,7 +15,7 @@ class Admin::TypesDeChampController < AdminController
|
||||||
end
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
@procedure.update_attributes(TypesDeChampService.create_update_procedure_params params)
|
@procedure.update(TypesDeChampService.create_update_procedure_params params)
|
||||||
create_facade
|
create_facade
|
||||||
flash.now.notice = 'Modifications sauvegardées'
|
flash.now.notice = 'Modifications sauvegardées'
|
||||||
render 'show', format: :js
|
render 'show', format: :js
|
||||||
|
|
|
@ -16,7 +16,7 @@ class Admin::TypesDeChampPrivateController < AdminController
|
||||||
end
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
@procedure.update_attributes(TypesDeChampService.create_update_procedure_params params, true)
|
@procedure.update(TypesDeChampService.create_update_procedure_params params, true)
|
||||||
create_facade
|
create_facade
|
||||||
flash.now.notice = 'Modifications sauvegardées'
|
flash.now.notice = 'Modifications sauvegardées'
|
||||||
render 'admin/types_de_champ/show', format: :js
|
render 'admin/types_de_champ/show', format: :js
|
||||||
|
|
|
@ -32,7 +32,7 @@ module NewGestionnaire
|
||||||
end
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
avis.update_attributes(avis_params)
|
avis.update(avis_params)
|
||||||
flash.notice = 'Votre réponse est enregistrée.'
|
flash.notice = 'Votre réponse est enregistrée.'
|
||||||
redirect_to instruction_gestionnaire_avis_path(avis)
|
redirect_to instruction_gestionnaire_avis_path(avis)
|
||||||
end
|
end
|
||||||
|
|
|
@ -57,13 +57,13 @@ module NewGestionnaire
|
||||||
end
|
end
|
||||||
|
|
||||||
def archive
|
def archive
|
||||||
dossier.update_attributes(archived: true)
|
dossier.update(archived: true)
|
||||||
current_gestionnaire.unfollow(dossier)
|
current_gestionnaire.unfollow(dossier)
|
||||||
redirect_back(fallback_location: gestionnaire_procedures_url)
|
redirect_back(fallback_location: gestionnaire_procedures_url)
|
||||||
end
|
end
|
||||||
|
|
||||||
def unarchive
|
def unarchive
|
||||||
dossier.update_attributes(archived: false)
|
dossier.update(archived: false)
|
||||||
redirect_back(fallback_location: gestionnaire_procedures_url)
|
redirect_back(fallback_location: gestionnaire_procedures_url)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -166,7 +166,7 @@ module NewGestionnaire
|
||||||
def update_annotations
|
def update_annotations
|
||||||
dossier = current_gestionnaire.dossiers.includes(champs_private: :type_de_champ).find(params[:dossier_id])
|
dossier = current_gestionnaire.dossiers.includes(champs_private: :type_de_champ).find(params[:dossier_id])
|
||||||
# FIXME: add attachements validation, cf. Champ#piece_justificative_file_errors
|
# FIXME: add attachements validation, cf. Champ#piece_justificative_file_errors
|
||||||
dossier.update_attributes(champs_private_params)
|
dossier.update(champs_private_params)
|
||||||
redirect_to annotations_privees_gestionnaire_dossier_path(procedure, dossier)
|
redirect_to annotations_privees_gestionnaire_dossier_path(procedure, dossier)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -109,11 +109,11 @@ module NewGestionnaire
|
||||||
c.to_json
|
c.to_json
|
||||||
end
|
end
|
||||||
|
|
||||||
procedure_presentation.update_attributes(displayed_fields: fields)
|
procedure_presentation.update(displayed_fields: fields)
|
||||||
|
|
||||||
current_sort = procedure_presentation.sort
|
current_sort = procedure_presentation.sort
|
||||||
if !values.include?("#{current_sort['table']}/#{current_sort['column']}")
|
if !values.include?("#{current_sort['table']}/#{current_sort['column']}")
|
||||||
procedure_presentation.update_attributes(sort: Procedure.default_sort)
|
procedure_presentation.update(sort: Procedure.default_sort)
|
||||||
end
|
end
|
||||||
|
|
||||||
redirect_back(fallback_location: gestionnaire_procedure_url(procedure))
|
redirect_back(fallback_location: gestionnaire_procedure_url(procedure))
|
||||||
|
@ -136,7 +136,7 @@ module NewGestionnaire
|
||||||
'order' => order
|
'order' => order
|
||||||
}.to_json
|
}.to_json
|
||||||
|
|
||||||
procedure_presentation.update_attributes(sort: sort)
|
procedure_presentation.update(sort: sort)
|
||||||
|
|
||||||
redirect_back(fallback_location: gestionnaire_procedure_url(procedure))
|
redirect_back(fallback_location: gestionnaire_procedure_url(procedure))
|
||||||
end
|
end
|
||||||
|
@ -154,7 +154,7 @@ module NewGestionnaire
|
||||||
'value' => params[:value]
|
'value' => params[:value]
|
||||||
}
|
}
|
||||||
|
|
||||||
procedure_presentation.update_attributes(filters: filters.to_json)
|
procedure_presentation.update(filters: filters.to_json)
|
||||||
end
|
end
|
||||||
|
|
||||||
redirect_back(fallback_location: gestionnaire_procedure_url(procedure))
|
redirect_back(fallback_location: gestionnaire_procedure_url(procedure))
|
||||||
|
@ -168,7 +168,7 @@ module NewGestionnaire
|
||||||
|
|
||||||
filters[statut] = filters[statut] - [filter_to_remove]
|
filters[statut] = filters[statut] - [filter_to_remove]
|
||||||
|
|
||||||
procedure_presentation.update_attributes(filters: filters.to_json)
|
procedure_presentation.update(filters: filters.to_json)
|
||||||
|
|
||||||
redirect_back(fallback_location: gestionnaire_procedure_url(procedure))
|
redirect_back(fallback_location: gestionnaire_procedure_url(procedure))
|
||||||
end
|
end
|
||||||
|
@ -245,7 +245,6 @@ module NewGestionnaire
|
||||||
.includes(filter['table'])
|
.includes(filter['table'])
|
||||||
.where("#{filter['table'].pluralize}.#{filter['column']} LIKE ?", "%#{filter['value']}%")
|
.where("#{filter['table'].pluralize}.#{filter['column']} LIKE ?", "%#{filter['value']}%")
|
||||||
end
|
end
|
||||||
|
|
||||||
end.pluck(:id)
|
end.pluck(:id)
|
||||||
end.reduce(:&)
|
end.reduce(:&)
|
||||||
end
|
end
|
||||||
|
|
|
@ -22,7 +22,7 @@ class Users::CarteController < UsersController
|
||||||
ModuleApiCartoService.save_cadastre! dossier, params[:json_latlngs]
|
ModuleApiCartoService.save_cadastre! dossier, params[:json_latlngs]
|
||||||
end
|
end
|
||||||
|
|
||||||
dossier.update_attributes(json_latlngs: params[:json_latlngs])
|
dossier.update(json_latlngs: params[:json_latlngs])
|
||||||
|
|
||||||
redirect_to modifier_dossier_path(dossier)
|
redirect_to modifier_dossier_path(dossier)
|
||||||
end
|
end
|
||||||
|
|
|
@ -156,7 +156,7 @@ class Users::DossiersController < UsersController
|
||||||
flash.alert = individual_errors
|
flash.alert = individual_errors
|
||||||
redirect_to users_dossier_path(id: @facade.dossier.id)
|
redirect_to users_dossier_path(id: @facade.dossier.id)
|
||||||
else
|
else
|
||||||
if !Dossier.find(@facade.dossier.id).update_attributes update_params_with_formatted_birthdate
|
if !Dossier.find(@facade.dossier.id).update update_params_with_formatted_birthdate
|
||||||
flash.alert = @facade.dossier.errors.full_messages
|
flash.alert = @facade.dossier.errors.full_messages
|
||||||
|
|
||||||
return redirect_to users_dossier_path(id: @facade.dossier.id)
|
return redirect_to users_dossier_path(id: @facade.dossier.id)
|
||||||
|
@ -259,7 +259,7 @@ class Users::DossiersController < UsersController
|
||||||
end
|
end
|
||||||
|
|
||||||
def update_current_user_siret! siret
|
def update_current_user_siret! siret
|
||||||
current_user.update_attributes(siret: siret)
|
current_user.update(siret: siret)
|
||||||
end
|
end
|
||||||
|
|
||||||
def facade id = params[:id]
|
def facade id = params[:id]
|
||||||
|
|
|
@ -20,7 +20,7 @@ class Users::SessionsController < Sessions::SessionsController
|
||||||
try_to_authenticate(Administrateur, remember_me)
|
try_to_authenticate(Administrateur, remember_me)
|
||||||
|
|
||||||
if user_signed_in?
|
if user_signed_in?
|
||||||
current_user.update_attributes(loged_in_with_france_connect: '')
|
current_user.update(loged_in_with_france_connect: '')
|
||||||
end
|
end
|
||||||
|
|
||||||
if user_signed_in?
|
if user_signed_in?
|
||||||
|
@ -44,7 +44,7 @@ class Users::SessionsController < Sessions::SessionsController
|
||||||
|
|
||||||
if user_signed_in?
|
if user_signed_in?
|
||||||
connected_with_france_connect = current_user.loged_in_with_france_connect
|
connected_with_france_connect = current_user.loged_in_with_france_connect
|
||||||
current_user.update_attributes(loged_in_with_france_connect: '')
|
current_user.update(loged_in_with_france_connect: '')
|
||||||
|
|
||||||
sign_out :user
|
sign_out :user
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ class Administrateur < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def renew_api_token
|
def renew_api_token
|
||||||
update_attributes(api_token: generate_api_token)
|
update(api_token: generate_api_token)
|
||||||
end
|
end
|
||||||
|
|
||||||
def registration_state
|
def registration_state
|
||||||
|
|
|
@ -42,7 +42,7 @@ class Procedure < ActiveRecord::Base
|
||||||
|
|
||||||
def hide!
|
def hide!
|
||||||
now = DateTime.now
|
now = DateTime.now
|
||||||
self.update_attributes(hidden_at: now)
|
self.update(hidden_at: now)
|
||||||
self.dossiers.update_all(hidden_at: now)
|
self.dossiers.update_all(hidden_at: now)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -89,8 +89,8 @@ class Procedure < ActiveRecord::Base
|
||||||
|
|
||||||
false
|
false
|
||||||
else
|
else
|
||||||
list[index_of_first_element].update_attributes(order_place: index_of_first_element + 1)
|
list[index_of_first_element].update(order_place: index_of_first_element + 1)
|
||||||
list[index_of_first_element + 1].update_attributes(order_place: index_of_first_element)
|
list[index_of_first_element + 1].update(order_place: index_of_first_element)
|
||||||
|
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
@ -129,7 +129,7 @@ class Procedure < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def publish!(path)
|
def publish!(path)
|
||||||
self.update_attributes!({ published_at: Time.now, archived_at: nil })
|
self.update!({ published_at: Time.now, archived_at: nil })
|
||||||
ProcedurePath.create!(path: path, procedure: self, administrateur: self.administrateur)
|
ProcedurePath.create!(path: path, procedure: self, administrateur: self.administrateur)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -138,7 +138,7 @@ class Procedure < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def archive
|
def archive
|
||||||
self.update_attributes!(archived_at: Time.now)
|
self.update!(archived_at: Time.now)
|
||||||
end
|
end
|
||||||
|
|
||||||
def archivee?
|
def archivee?
|
||||||
|
|
|
@ -25,7 +25,7 @@ class User < ActiveRecord::Base
|
||||||
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
|
||||||
user.update_attributes(siret: siret)
|
user.update(siret: siret)
|
||||||
user
|
user
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
#!/usr/bin/env ruby
|
#!/usr/bin/env ruby
|
||||||
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
|
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
|
||||||
load Gem.bin_path('bundler', 'bundle')
|
load Gem.bin_path('bundler', 'bundle')
|
||||||
|
|
|
@ -4,7 +4,7 @@ require 'fileutils'
|
||||||
include FileUtils
|
include FileUtils
|
||||||
|
|
||||||
# path to your application root.
|
# path to your application root.
|
||||||
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
|
APP_ROOT = Pathname.new File.expand_path('../', __dir__)
|
||||||
|
|
||||||
def system!(*args)
|
def system!(*args)
|
||||||
system(*args) || abort("\n== Command #{args} failed ==")
|
system(*args) || abort("\n== Command #{args} failed ==")
|
||||||
|
|
|
@ -4,7 +4,7 @@ require 'fileutils'
|
||||||
include FileUtils
|
include FileUtils
|
||||||
|
|
||||||
# path to your application root.
|
# path to your application root.
|
||||||
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
|
APP_ROOT = Pathname.new File.expand_path('../', __dir__)
|
||||||
|
|
||||||
def system!(*args)
|
def system!(*args)
|
||||||
system(*args) || abort("\n== Command #{args} failed ==")
|
system(*args) || abort("\n== Command #{args} failed ==")
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
require File.expand_path('../boot', __FILE__)
|
require File.expand_path('boot', __dir__)
|
||||||
|
|
||||||
require 'rails/all'
|
require 'rails/all'
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
|
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
|
||||||
|
|
||||||
require 'bundler/setup' # Set up gems listed in the Gemfile.
|
require 'bundler/setup' # Set up gems listed in the Gemfile.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# Load the Rails application.
|
# Load the Rails application.
|
||||||
require File.expand_path('../application', __FILE__)
|
require File.expand_path('application', __dir__)
|
||||||
|
|
||||||
# Initialize the Rails application.
|
# Initialize the Rails application.
|
||||||
Rails.application.initialize!
|
Rails.application.initialize!
|
||||||
|
|
|
@ -2,7 +2,7 @@ class LinkTypePieceJointeToFormulaire < ActiveRecord::Migration
|
||||||
# def up
|
# def up
|
||||||
# TypePieceJointe.find_each do |type_piece_jointe|
|
# TypePieceJointe.find_each do |type_piece_jointe|
|
||||||
# forms = Formulaire.find_by_demarche_id(type_piece_jointe.CERFA)
|
# forms = Formulaire.find_by_demarche_id(type_piece_jointe.CERFA)
|
||||||
# type_piece_jointe.update_attributes(formulaire_id: forms.id) if forms.present?
|
# type_piece_jointe.update(formulaire_id: forms.id) if forms.present?
|
||||||
# end
|
# end
|
||||||
# end
|
# end
|
||||||
end
|
end
|
||||||
|
|
|
@ -46,7 +46,7 @@ class CreateFranceConnectInformation < ActiveRecord::Migration
|
||||||
add_column :users, :france_connect_particulier_id, :string
|
add_column :users, :france_connect_particulier_id, :string
|
||||||
|
|
||||||
FranceConnectInformation.all.each do |fci|
|
FranceConnectInformation.all.each do |fci|
|
||||||
User.find(fci.user_id).update_attributes({
|
User.find(fci.user_id).update({
|
||||||
gender: fci.gender,
|
gender: fci.gender,
|
||||||
given_name: fci.given_name,
|
given_name: fci.given_name,
|
||||||
family_name: fci.family_name,
|
family_name: fci.family_name,
|
||||||
|
|
|
@ -140,7 +140,7 @@ describe Admin::AttestationTemplatesController, type: :controller do
|
||||||
|
|
||||||
context 'when something wrong happens in the attestation template creation' do
|
context 'when something wrong happens in the attestation template creation' do
|
||||||
before do
|
before do
|
||||||
expect_any_instance_of(AttestationTemplate).to receive(:update_attributes).and_return(false)
|
expect_any_instance_of(AttestationTemplate).to receive(:update).and_return(false)
|
||||||
expect_any_instance_of(AttestationTemplate).to receive(:errors)
|
expect_any_instance_of(AttestationTemplate).to receive(:errors)
|
||||||
.and_return(double(full_messages: ['nop']))
|
.and_return(double(full_messages: ['nop']))
|
||||||
|
|
||||||
|
|
|
@ -145,7 +145,7 @@ describe InvitesController, type: :controller do
|
||||||
|
|
||||||
context 'when user has access to dossier' do
|
context 'when user has access to dossier' do
|
||||||
before do
|
before do
|
||||||
dossier.update_attributes(user: signed_in_profile)
|
dossier.update(user: signed_in_profile)
|
||||||
end
|
end
|
||||||
|
|
||||||
it { expect { subject }.to change(InviteUser, :count).by(1) }
|
it { expect { subject }.to change(InviteUser, :count).by(1) }
|
||||||
|
|
|
@ -94,7 +94,7 @@ describe NewGestionnaire::DossiersController, type: :controller do
|
||||||
|
|
||||||
describe '#unarchive' do
|
describe '#unarchive' do
|
||||||
before do
|
before do
|
||||||
dossier.update_attributes(archived: true)
|
dossier.update(archived: true)
|
||||||
patch :unarchive, params: { procedure_id: procedure.id, dossier_id: dossier.id }
|
patch :unarchive, params: { procedure_id: procedure.id, dossier_id: dossier.id }
|
||||||
dossier.reload
|
dossier.reload
|
||||||
end
|
end
|
||||||
|
|
|
@ -122,7 +122,7 @@ describe NewUser::DossiersController, type: :controller do
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when the dossier is for an personne physique' do
|
context 'when the dossier is for an personne physique' do
|
||||||
before { dossier.procedure.update_attributes(for_individual: true) }
|
before { dossier.procedure.update(for_individual: true) }
|
||||||
|
|
||||||
it { is_expected.to redirect_to(identite_dossier_path(dossier)) }
|
it { is_expected.to redirect_to(identite_dossier_path(dossier)) }
|
||||||
end
|
end
|
||||||
|
@ -215,7 +215,7 @@ describe NewUser::DossiersController, type: :controller do
|
||||||
let(:value) { nil }
|
let(:value) { nil }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
first_champ.type_de_champ.update_attributes(mandatory: true, libelle: 'l')
|
first_champ.type_de_champ.update(mandatory: true, libelle: 'l')
|
||||||
allow(PiecesJustificativesService).to receive(:missing_pj_error_messages).and_return(['pj'])
|
allow(PiecesJustificativesService).to receive(:missing_pj_error_messages).and_return(['pj'])
|
||||||
|
|
||||||
subject
|
subject
|
||||||
|
|
|
@ -158,7 +158,7 @@ describe Users::SessionsController, type: :controller do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'signs user out from france connect' do
|
it 'signs user out from france connect' do
|
||||||
user.update_attributes(loged_in_with_france_connect: 'particulier')
|
user.update(loged_in_with_france_connect: 'particulier')
|
||||||
sign_in user
|
sign_in user
|
||||||
delete :destroy
|
delete :destroy
|
||||||
expect(@response.headers["Location"]).to eq(FRANCE_CONNECT[:particulier][:logout_endpoint])
|
expect(@response.headers["Location"]).to eq(FRANCE_CONNECT[:particulier][:logout_endpoint])
|
||||||
|
|
|
@ -9,7 +9,7 @@ feature "procedure filters" do
|
||||||
let!(:new_unfollow_dossier_2) { create(:dossier, procedure: procedure, state: "en_instruction") }
|
let!(:new_unfollow_dossier_2) { create(:dossier, procedure: procedure, state: "en_instruction") }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
champ.update_attributes(value: "Mon champ rempli")
|
champ.update(value: "Mon champ rempli")
|
||||||
login_as gestionnaire, scope: :gestionnaire
|
login_as gestionnaire, scope: :gestionnaire
|
||||||
visit gestionnaire_procedure_path(procedure)
|
visit gestionnaire_procedure_path(procedure)
|
||||||
end
|
end
|
||||||
|
|
|
@ -32,7 +32,7 @@ describe Administrateur, type: :model do
|
||||||
administrateur = create(:administrateur)
|
administrateur = create(:administrateur)
|
||||||
user = create(:user, email: administrateur.email)
|
user = create(:user, email: administrateur.email)
|
||||||
|
|
||||||
administrateur.update_attributes(email: 'whoami@plop.com', password: 'super secret')
|
administrateur.update(email: 'whoami@plop.com', password: 'super secret')
|
||||||
|
|
||||||
user.reload
|
user.reload
|
||||||
expect(user.email).to eq('whoami@plop.com')
|
expect(user.email).to eq('whoami@plop.com')
|
||||||
|
@ -43,7 +43,7 @@ describe Administrateur, type: :model do
|
||||||
administrateur = create(:administrateur)
|
administrateur = create(:administrateur)
|
||||||
gestionnaire = create(:gestionnaire, email: administrateur.email)
|
gestionnaire = create(:gestionnaire, email: administrateur.email)
|
||||||
|
|
||||||
administrateur.update_attributes(email: 'whoami@plop.com', password: 'super secret')
|
administrateur.update(email: 'whoami@plop.com', password: 'super secret')
|
||||||
|
|
||||||
gestionnaire.reload
|
gestionnaire.reload
|
||||||
expect(gestionnaire.email).to eq('whoami@plop.com')
|
expect(gestionnaire.email).to eq('whoami@plop.com')
|
||||||
|
|
|
@ -163,12 +163,12 @@ describe AttestationTemplate, type: :model do
|
||||||
dossier.champs
|
dossier.champs
|
||||||
.select { |champ| champ.libelle == 'libelleA' }
|
.select { |champ| champ.libelle == 'libelleA' }
|
||||||
.first
|
.first
|
||||||
.update_attributes(value: 'libelle1')
|
.update(value: 'libelle1')
|
||||||
|
|
||||||
dossier.champs
|
dossier.champs
|
||||||
.select { |champ| champ.libelle == 'libelleB' }
|
.select { |champ| champ.libelle == 'libelleB' }
|
||||||
.first
|
.first
|
||||||
.update_attributes(value: 'libelle2')
|
.update(value: 'libelle2')
|
||||||
end
|
end
|
||||||
|
|
||||||
it { expect(view_args[:title]).to eq('title libelle1') }
|
it { expect(view_args[:title]).to eq('title libelle1') }
|
||||||
|
|
|
@ -99,12 +99,12 @@ describe TagsSubstitutionConcern, type: :model do
|
||||||
dossier.champs
|
dossier.champs
|
||||||
.select { |champ| champ.libelle == 'libelleA' }
|
.select { |champ| champ.libelle == 'libelleA' }
|
||||||
.first
|
.first
|
||||||
.update_attributes(value: 'libelle1')
|
.update(value: 'libelle1')
|
||||||
|
|
||||||
dossier.champs
|
dossier.champs
|
||||||
.select { |champ| champ.libelle == 'libelleB' }
|
.select { |champ| champ.libelle == 'libelleB' }
|
||||||
.first
|
.first
|
||||||
.update_attributes(value: 'libelle2')
|
.update(value: 'libelle2')
|
||||||
end
|
end
|
||||||
|
|
||||||
it { is_expected.to eq('libelle1 libelle2') }
|
it { is_expected.to eq('libelle1 libelle2') }
|
||||||
|
@ -129,7 +129,7 @@ describe TagsSubstitutionConcern, type: :model do
|
||||||
let(:template) { '--libelleA--' }
|
let(:template) { '--libelleA--' }
|
||||||
|
|
||||||
context 'and its value in the dossier is not nil' do
|
context 'and its value in the dossier is not nil' do
|
||||||
before { dossier.champs_private.first.update_attributes(value: 'libelle1') }
|
before { dossier.champs_private.first.update(value: 'libelle1') }
|
||||||
|
|
||||||
it { is_expected.to eq('libelle1') }
|
it { is_expected.to eq('libelle1') }
|
||||||
end
|
end
|
||||||
|
@ -152,7 +152,7 @@ describe TagsSubstitutionConcern, type: :model do
|
||||||
context 'champs publics are valid tags' do
|
context 'champs publics are valid tags' do
|
||||||
let(:types_de_champ) { [create(:type_de_champ, libelle: 'libelleA')] }
|
let(:types_de_champ) { [create(:type_de_champ, libelle: 'libelleA')] }
|
||||||
|
|
||||||
before { dossier.champs.first.update_attributes(value: 'libelle1') }
|
before { dossier.champs.first.update(value: 'libelle1') }
|
||||||
|
|
||||||
it { is_expected.to eq('libelle1') }
|
it { is_expected.to eq('libelle1') }
|
||||||
end
|
end
|
||||||
|
@ -174,12 +174,12 @@ describe TagsSubstitutionConcern, type: :model do
|
||||||
dossier.champs
|
dossier.champs
|
||||||
.select { |champ| champ.type_champ == 'date' }
|
.select { |champ| champ.type_champ == 'date' }
|
||||||
.first
|
.first
|
||||||
.update_attributes(value: '2017-04-15')
|
.update(value: '2017-04-15')
|
||||||
|
|
||||||
dossier.champs
|
dossier.champs
|
||||||
.select { |champ| champ.type_champ == 'datetime' }
|
.select { |champ| champ.type_champ == 'datetime' }
|
||||||
.first
|
.first
|
||||||
.update_attributes(value: '2017-09-13 09:00')
|
.update(value: '2017-09-13 09:00')
|
||||||
end
|
end
|
||||||
|
|
||||||
it { is_expected.to eq('15/04/2017 2017-09-13 09:00') }
|
it { is_expected.to eq('15/04/2017 2017-09-13 09:00') }
|
||||||
|
@ -220,7 +220,7 @@ describe TagsSubstitutionConcern, type: :model do
|
||||||
end
|
end
|
||||||
|
|
||||||
context "match breaking and non breaking spaces" do
|
context "match breaking and non breaking spaces" do
|
||||||
before { dossier.champs.first.update_attributes(value: 'valeur') }
|
before { dossier.champs.first.update(value: 'valeur') }
|
||||||
|
|
||||||
shared_examples "treat all kinds of space as equivalent" do
|
shared_examples "treat all kinds of space as equivalent" do
|
||||||
context 'and the champ has a non breaking space' do
|
context 'and the champ has a non breaking space' do
|
||||||
|
|
|
@ -112,7 +112,7 @@ describe Dossier do
|
||||||
|
|
||||||
it 'does not create default champs' do
|
it 'does not create default champs' do
|
||||||
expect(subject).not_to receive(:build_default_champs)
|
expect(subject).not_to receive(:build_default_champs)
|
||||||
subject.update_attributes(state: 'en_construction')
|
subject.update(state: 'en_construction')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -116,7 +116,7 @@ describe Gestionnaire, type: :model do
|
||||||
gestionnaire = create(:gestionnaire)
|
gestionnaire = create(:gestionnaire)
|
||||||
user = create(:user, email: gestionnaire.email)
|
user = create(:user, email: gestionnaire.email)
|
||||||
|
|
||||||
gestionnaire.update_attributes(email: 'whoami@plop.com', password: 'super secret')
|
gestionnaire.update(email: 'whoami@plop.com', password: 'super secret')
|
||||||
|
|
||||||
user.reload
|
user.reload
|
||||||
expect(user.email).to eq('whoami@plop.com')
|
expect(user.email).to eq('whoami@plop.com')
|
||||||
|
@ -127,7 +127,7 @@ describe Gestionnaire, type: :model do
|
||||||
gestionnaire = create(:gestionnaire)
|
gestionnaire = create(:gestionnaire)
|
||||||
admin = create(:administrateur, email: gestionnaire.email)
|
admin = create(:administrateur, email: gestionnaire.email)
|
||||||
|
|
||||||
gestionnaire.update_attributes(email: 'whoami@plop.com', password: 'super secret')
|
gestionnaire.update(email: 'whoami@plop.com', password: 'super secret')
|
||||||
|
|
||||||
admin.reload
|
admin.reload
|
||||||
expect(admin.email).to eq('whoami@plop.com')
|
expect(admin.email).to eq('whoami@plop.com')
|
||||||
|
|
|
@ -352,16 +352,16 @@ describe Procedure do
|
||||||
procedure.types_de_champ_private << tcp_2 << tcp_1
|
procedure.types_de_champ_private << tcp_2 << tcp_1
|
||||||
|
|
||||||
dossier.build_default_champs
|
dossier.build_default_champs
|
||||||
dossier.champs.find_by(type_de_champ: tc_1).update_attributes(value: "value 1")
|
dossier.champs.find_by(type_de_champ: tc_1).update(value: "value 1")
|
||||||
dossier.champs.find_by(type_de_champ: tc_2).update_attributes(value: "value 2")
|
dossier.champs.find_by(type_de_champ: tc_2).update(value: "value 2")
|
||||||
dossier.champs_private.find_by(type_de_champ: tcp_1).update_attributes(value: "private value 1")
|
dossier.champs_private.find_by(type_de_champ: tcp_1).update(value: "private value 1")
|
||||||
dossier.champs_private.find_by(type_de_champ: tcp_2).update_attributes(value: "private value 2")
|
dossier.champs_private.find_by(type_de_champ: tcp_2).update(value: "private value 2")
|
||||||
|
|
||||||
dossier2.build_default_champs
|
dossier2.build_default_champs
|
||||||
dossier2.champs.find_by(type_de_champ: tc_1).update_attributes(value: "value 1")
|
dossier2.champs.find_by(type_de_champ: tc_1).update(value: "value 1")
|
||||||
dossier2.champs.find_by(type_de_champ: tc_2).update_attributes(value: "value 2")
|
dossier2.champs.find_by(type_de_champ: tc_2).update(value: "value 2")
|
||||||
dossier2.champs_private.find_by(type_de_champ: tcp_1).update_attributes(value: "private value 1")
|
dossier2.champs_private.find_by(type_de_champ: tcp_1).update(value: "private value 1")
|
||||||
dossier2.champs_private.find_by(type_de_champ: tcp_2).update_attributes(value: "private value 2")
|
dossier2.champs_private.find_by(type_de_champ: tcp_2).update(value: "private value 2")
|
||||||
end
|
end
|
||||||
|
|
||||||
it { expect(subject[:headers].index(tc_1.libelle.parameterize.underscore.to_sym)).to be < subject[:headers].index(tc_2.libelle.parameterize.underscore.to_sym) }
|
it { expect(subject[:headers].index(tc_1.libelle.parameterize.underscore.to_sym)).to be < subject[:headers].index(tc_2.libelle.parameterize.underscore.to_sym) }
|
||||||
|
|
|
@ -55,7 +55,7 @@ describe User, type: :model do
|
||||||
user = create(:user)
|
user = create(:user)
|
||||||
gestionnaire = create(:gestionnaire, email: user.email)
|
gestionnaire = create(:gestionnaire, email: user.email)
|
||||||
|
|
||||||
user.update_attributes(email: 'whoami@plop.com', password: 'super secret')
|
user.update(email: 'whoami@plop.com', password: 'super secret')
|
||||||
|
|
||||||
gestionnaire.reload
|
gestionnaire.reload
|
||||||
expect(gestionnaire.email).to eq('whoami@plop.com')
|
expect(gestionnaire.email).to eq('whoami@plop.com')
|
||||||
|
@ -66,7 +66,7 @@ describe User, type: :model do
|
||||||
user = create(:user)
|
user = create(:user)
|
||||||
admin = create(:administrateur, email: user.email)
|
admin = create(:administrateur, email: user.email)
|
||||||
|
|
||||||
user.update_attributes(email: 'whoami@plop.com', password: 'super secret')
|
user.update(email: 'whoami@plop.com', password: 'super secret')
|
||||||
|
|
||||||
admin.reload
|
admin.reload
|
||||||
expect(admin.email).to eq('whoami@plop.com')
|
expect(admin.email).to eq('whoami@plop.com')
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# This file is copied to spec/ when you run 'rails generate rspec:install'
|
# This file is copied to spec/ when you run 'rails generate rspec:install'
|
||||||
ENV['RAILS_ENV'] ||= 'test'
|
ENV['RAILS_ENV'] ||= 'test'
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
require File.expand_path('../../config/environment', __FILE__)
|
require File.expand_path('../config/environment', __dir__)
|
||||||
require 'rspec/rails'
|
require 'rspec/rails'
|
||||||
# Add additional requires below this line. Rails is not loaded until this point!
|
# Add additional requires below this line. Rails is not loaded until this point!
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
ENV['RAILS_ENV'] ||= 'test'
|
ENV['RAILS_ENV'] ||= 'test'
|
||||||
|
|
||||||
require File.expand_path('../../config/environment', __FILE__)
|
require File.expand_path('../config/environment', __dir__)
|
||||||
require 'rspec/rails'
|
require 'rspec/rails'
|
||||||
require 'capybara/rspec'
|
require 'capybara/rspec'
|
||||||
require 'database_cleaner'
|
require 'database_cleaner'
|
||||||
|
|
|
@ -6,7 +6,7 @@ describe 'new_gestionnaire/dossiers/identite_entreprise.html.haml', type: :view
|
||||||
let(:entreprise) { rna_information.entreprise }
|
let(:entreprise) { rna_information.entreprise }
|
||||||
|
|
||||||
context "date_publication is missing on rna" do
|
context "date_publication is missing on rna" do
|
||||||
before { rna_information.update_attributes(date_publication: nil) }
|
before { rna_information.update(date_publication: nil) }
|
||||||
|
|
||||||
it "can render without error" do
|
it "can render without error" do
|
||||||
expect(rendered).to include("Date de publication :")
|
expect(rendered).to include("Date de publication :")
|
||||||
|
|
Loading…
Reference in a new issue