Merge pull request #2722 from betagouv/rubocop

Rubocop
This commit is contained in:
gregoirenovel 2018-10-03 12:31:47 +02:00 committed by GitHub
commit b6e98ac4a3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
67 changed files with 105 additions and 111 deletions

View file

@ -1199,13 +1199,15 @@ Style/StructInheritance:
Enabled: false
Style/SymbolArray:
Enabled: false
Enabled: true
EnforcedStyle: brackets
Style/SymbolLiteral:
Enabled: false
Enabled: true
Style/SymbolProc:
Enabled: false
Enabled: true
IgnoredMethods: [after]
Style/TernaryParentheses:
Enabled: false
@ -1220,13 +1222,13 @@ Style/TrailingBodyOnModule:
Enabled: true
Style/TrailingCommaInArguments:
Enabled: false
Enabled: true
Style/TrailingCommaInArrayLiteral:
Enabled: false
Enabled: true
Style/TrailingCommaInHashLiteral:
Enabled: false
Enabled: true
Style/TrailingMethodEndStatement:
Enabled: true
@ -1241,31 +1243,33 @@ Style/UnlessElse:
Enabled: true
Style/UnneededCapitalW:
Enabled: false
Enabled: true
Style/UnneededInterpolation:
Enabled: false
Enabled: true
Style/UnneededPercentQ:
Enabled: false
Enabled: true
Style/VariableInterpolation:
Enabled: false
Enabled: true
Style/WhenThen:
Enabled: false
Style/WhileUntilDo:
Enabled: false
Enabled: true
# Disabled because we don't want to use modifiers
Style/WhileUntilModifier:
Enabled: false
Style/WordArray:
Enabled: false
Enabled: true
EnforcedStyle: brackets
Style/YodaCondition:
Enabled: false
Enabled: true
Style/ZeroLengthPredicate:
Enabled: false
Enabled: true

View file

@ -39,7 +39,7 @@ guard 'livereload' do
# less: :less, # uncomment if you want LESS stylesheets done in browser
}
rails_view_exts = %w(erb haml slim)
rails_view_exts = ['erb', 'haml', 'slim']
# file types LiveReload may optimize refresh for
compiled_exts = extensions.values

View file

@ -35,7 +35,7 @@ class Admin::MailTemplatesController < AdminController
{
procedure_id: params[:procedure_id],
subject: params[:mail_template][:subject],
body: params[:mail_template][:body],
body: params[:mail_template][:body]
}
end
end

View file

@ -123,7 +123,7 @@ class ApplicationController < ActionController::Base
payload.merge!({
browser: browser.name,
browser_version: browser.version.to_s,
platform: browser.platform.name,
platform: browser.platform.name
})
end
@ -143,7 +143,7 @@ class ApplicationController < ActionController::Base
elsif api_request
render json: { error: MAINTENANCE_MESSAGE }.to_json, status: :service_unavailable
else
%i(user gestionnaire administrateur).each { |role| sign_out(role) }
[:user, :gestionnaire, :administrateur].each { |role| sign_out(role) }
flash[:alert] = MAINTENANCE_MESSAGE
redirect_to root_path
end

View file

@ -10,7 +10,7 @@ class FranceConnect::ParticulierController < ApplicationController
fci = FranceConnectInformation
.find_by(france_connect_particulier_id: fetched_fci[:france_connect_particulier_id]) ||
fetched_fci.tap { |object| object.save }
fetched_fci.tap(&:save)
if fci.user.nil?
user = User.find_or_create_by(email: fci.email_france_connect) do |new_user|

View file

@ -1,6 +1,6 @@
class Gestionnaires::PasswordsController < Devise::PasswordsController
after_action :try_to_authenticate_user, only: %i(update)
after_action :try_to_authenticate_administrateur, only: %i(update)
after_action :try_to_authenticate_user, only: [:update]
after_action :try_to_authenticate_administrateur, only: [:update]
# GET /resource/password/new
# def new

View file

@ -8,7 +8,7 @@ module Manager
redirect_to manager_administrateurs_path
else
render :new, locals: {
page: Administrate::Page::Form.new(dashboard, administrateur),
page: Administrate::Page::Form.new(dashboard, administrateur)
}
end
end

View file

@ -6,7 +6,7 @@ module NewUser
.includes(:procedure)
.map(&:procedure)
.uniq
.select { |p| p.publiee? }
.select(&:publiee?)
@popular_demarches = Procedure
.includes(:service)

View file

@ -211,7 +211,7 @@ class StatsController < ApplicationController
{
'Une démarche' => count_per_administrateur.select { |count| count == 1 }.count,
'Entre deux et cinq démarches' => count_per_administrateur.select { |count| count.in?(2..5) }.count,
'Plus de cinq démarches' => count_per_administrateur.select { |count| 5 < count }.count
'Plus de cinq démarches' => count_per_administrateur.select { |count| count > 5 }.count
}
end

View file

@ -1,6 +1,6 @@
class Users::PasswordsController < Devise::PasswordsController
after_action :try_to_authenticate_gestionnaire, only: %i(update)
after_action :try_to_authenticate_administrateur, only: %i(update)
after_action :try_to_authenticate_gestionnaire, only: [:update]
after_action :try_to_authenticate_administrateur, only: [:update]
# GET /resource/password/new
# def new

View file

@ -27,7 +27,7 @@ class AdministrateurDashboard < Administrate::BaseDashboard
:email,
:created_at,
:procedures,
:registration_state,
:registration_state
].freeze
# SHOW_PAGE_ATTRIBUTES
@ -40,7 +40,7 @@ class AdministrateurDashboard < Administrate::BaseDashboard
:registration_state,
:current_sign_in_at,
:features,
:procedures,
:procedures
].freeze
# FORM_ATTRIBUTES

View file

@ -15,7 +15,7 @@ class DossierDashboard < Administrate::BaseDashboard
created_at: Field::DateTime,
updated_at: Field::DateTime,
hidden_at: Field::DateTime,
types_de_champ: TypesDeChampCollectionField,
types_de_champ: TypesDeChampCollectionField
}.freeze
# COLLECTION_ATTRIBUTES

View file

@ -24,7 +24,7 @@ class GestionnaireDashboard < Administrate::BaseDashboard
# Feel free to add, remove, or rearrange items.
COLLECTION_ATTRIBUTES = [
:email,
:created_at,
:created_at
].freeze
# SHOW_PAGE_ATTRIBUTES
@ -35,7 +35,7 @@ class GestionnaireDashboard < Administrate::BaseDashboard
:id,
:email,
:current_sign_in_at,
:created_at,
:created_at
].freeze
# FORM_ATTRIBUTES

View file

@ -33,7 +33,7 @@ class ProcedureDashboard < Administrate::BaseDashboard
received_mail_template: MailTemplateField,
closed_mail_template: MailTemplateField,
refused_mail_template: MailTemplateField,
without_continuation_mail_template: MailTemplateField,
without_continuation_mail_template: MailTemplateField
}.freeze
# COLLECTION_ATTRIBUTES
@ -47,7 +47,7 @@ class ProcedureDashboard < Administrate::BaseDashboard
:libelle,
:organisation,
:dossiers,
:published_at,
:published_at
].freeze
# SHOW_PAGE_ATTRIBUTES
@ -77,7 +77,7 @@ class ProcedureDashboard < Administrate::BaseDashboard
:received_mail_template,
:closed_mail_template,
:refused_mail_template,
:without_continuation_mail_template,
:without_continuation_mail_template
].freeze
# FORM_ATTRIBUTES

View file

@ -19,7 +19,7 @@ class ServiceDashboard < Administrate::BaseDashboard
telephone: Field::String,
horaires: Field::String,
adresse: Field::String,
siret: Field::String,
siret: Field::String
}.freeze
# COLLECTION_ATTRIBUTES
@ -29,7 +29,7 @@ class ServiceDashboard < Administrate::BaseDashboard
# Feel free to add, remove, or rearrange items.
COLLECTION_ATTRIBUTES = [
:nom,
:type_organisme,
:type_organisme
].freeze
# SHOW_PAGE_ATTRIBUTES
@ -46,7 +46,7 @@ class ServiceDashboard < Administrate::BaseDashboard
:telephone,
:horaires,
:adresse,
:siret,
:siret
].freeze
# FORM_ATTRIBUTES

View file

@ -14,7 +14,7 @@ class UserDashboard < Administrate::BaseDashboard
created_at: Field::DateTime,
updated_at: Field::DateTime,
current_sign_in_at: Field::DateTime,
dossiers: Field::HasMany,
dossiers: Field::HasMany
}.freeze
# COLLECTION_ATTRIBUTES
@ -24,7 +24,7 @@ class UserDashboard < Administrate::BaseDashboard
# Feel free to add, remove, or rearrange items.
COLLECTION_ATTRIBUTES = [
:email,
:created_at,
:created_at
].freeze
# SHOW_PAGE_ATTRIBUTES
@ -35,7 +35,7 @@ class UserDashboard < Administrate::BaseDashboard
:email,
:confirmed?,
:current_sign_in_at,
:created_at,
:created_at
].freeze
# FORM_ATTRIBUTES

View file

@ -28,7 +28,7 @@ class TypeDeChampDecorator < Draper::Decorator
end
def base_classes
%w(btn btn-default form-control fa)
['btn', 'btn-default', 'form-control', 'fa']
end
def display_up_button?(index, private)

View file

@ -23,7 +23,7 @@ class TypeDePieceJustificativeDecorator < Draper::Decorator
end
def base_classes
%w(btn btn-default form-control fa)
['btn', 'btn-default', 'form-control', 'fa']
end
def display_up_button?(index)

View file

@ -2,6 +2,6 @@ module StringToHtmlHelper
def string_to_html(str)
html_formatted = simple_format(str)
with_links = html_formatted.gsub(URI.regexp, '<a target="_blank" href="\0">\0</a>')
sanitize(with_links, attributes: %w(href target))
sanitize(with_links, attributes: ['href', 'target'])
end
end

View file

@ -2,8 +2,6 @@ class Administrateurs::ActivateBeforeExpirationJob < ApplicationJob
queue_as :cron
def perform(*args)
Administrateur.inactive.where(created_at: 3.days.ago.all_day).each do |a|
a.remind_invitation!
end
Administrateur.inactive.where(created_at: 3.days.ago.all_day).each(&:remind_invitation!)
end
end

View file

@ -3,9 +3,7 @@ class AutoArchiveProcedureJob < ApplicationJob
def perform(*args)
Procedure.publiees.where("auto_archive_on <= ?", Date.today).each do |procedure|
procedure.dossiers.state_en_construction.each do |dossier|
dossier.en_instruction!
end
procedure.dossiers.state_en_construction.each(&:en_instruction!)
procedure.archive!
end

View file

@ -20,7 +20,7 @@ module Carto
def convert_driver_result_to_full_address
result = JSON.parse(driver.call)
if result['features'].size == 0
if result['features'].empty?
Rails.logger.error "unable to find location for address #{@address}"
return []
end

View file

@ -19,7 +19,7 @@ module Carto
def convert_driver_result_to_point
result = JSON.parse(driver.call)
if result['features'].size == 0
if result['features'].empty?
Rails.logger.error "unable to find location for address #{@address}"
return nil
end

View file

@ -19,7 +19,7 @@ class CARTO::SGMAP::API
RestClient::Resource.new(
url,
verify_ssl: verify_ssl_mode,
verify_ssl: verify_ssl_mode
).post params[:geojson], content_type: 'application/json'
rescue RestClient::InternalServerError

View file

@ -55,7 +55,7 @@ class Pipedrive::DealAdapter
user_id: Pipedrive::PersonAdapter::PIPEDRIVE_ROBOT_ID,
"#{PIPEDRIVE_NB_OF_PROCEDURES_ATTRIBUTE_ID}": nb_of_procedures,
value: nb_of_dossiers,
"#{PIPEDRIVE_DEADLINE_ATTRIBUTE_ID}": deadline,
"#{PIPEDRIVE_DEADLINE_ATTRIBUTE_ID}": deadline
}
Pipedrive::API.post_deal(params)

View file

@ -61,7 +61,7 @@ class AttestationTemplate < ApplicationRecord
end
def logo_signature_file_size
%i[logo signature]
[:logo, :signature]
.select { |file_name| send(file_name).present? }
.each { |file_name| file_size_check(file_name) }
end

View file

@ -76,7 +76,7 @@ class Gestionnaire < ApplicationRecord
else
{
start_date: start_date,
procedure_overviews: active_procedure_overviews,
procedure_overviews: active_procedure_overviews
}
end
end

View file

@ -224,7 +224,7 @@ class Procedure < ApplicationRecord
procedure.logo_secure_token = nil
procedure.remote_logo_url = self.logo_url
%i(notice deliberation).each { |attachment| clone_attachment(procedure, attachment) }
[:notice, :deliberation].each { |attachment| clone_attachment(procedure, attachment) }
procedure.administrateur = admin
procedure.initiated_mail = initiated_mail&.dup

View file

@ -4,7 +4,7 @@ class VirusScan < ApplicationRecord
enum status: {
pending: 'pending',
safe: 'safe',
infected: 'infected',
infected: 'infected'
}
validates :champ_id, uniqueness: { scope: :blob_key }

View file

@ -14,7 +14,7 @@ class ChampsService
def check_piece_justificative_files(champs)
champs.select do |champ|
champ.type_champ == TypeDeChamp.type_champs.fetch(:piece_justificative)
end.map { |c| c.piece_justificative_file_errors }.flatten
end.map(&:piece_justificative_file_errors).flatten
end
private

View file

@ -174,7 +174,7 @@ class DossierFieldService
end
def assert_valid_order(order)
if !%w[asc desc].include?(order)
if !["asc", "desc"].include?(order)
raise "Invalid order #{order}"
end
end

View file

@ -6,7 +6,7 @@ class TypesDeChampService
parameters = params_with_ordered_champs
.require(:procedure)
.permit("#{attributes}" => [
.permit(attributes.to_s => [
:libelle,
:description,
:order_place,
@ -70,6 +70,6 @@ class TypesDeChampService
end
def self.clean_value(value)
value.split("\r\n").map{ |v| v.strip }.join("\r\n")
value.split("\r\n").map(&:strip).join("\r\n")
end
end

View file

@ -21,7 +21,7 @@ class AttestationTemplateLogoUploader < BaseUploader
# Add a white list of extensions which are allowed to be uploaded.
# For images you might use something like this:
def extension_white_list
%w(jpg jpeg png)
['jpg', 'jpeg', 'png']
end
def filename

View file

@ -21,7 +21,7 @@ class AttestationTemplateSignatureUploader < BaseUploader
# Add a white list of extensions which are allowed to be uploaded.
# For images you might use something like this:
def extension_white_list
%w(jpg jpeg png)
['jpg', 'jpeg', 'png']
end
def filename

View file

@ -14,7 +14,7 @@ class CommentaireFileUploader < BaseUploader
end
def extension_white_list
%w(pdf doc docx xls xlsx ppt pptx odt ods odp jpg jpeg png zip txt)
['pdf', 'doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx', 'odt', 'ods', 'odp', 'jpg', 'jpeg', 'png', 'zip', 'txt']
end
def accept_extension_list

View file

@ -19,7 +19,7 @@ class PieceJustificativeUploader < BaseUploader
# Add a white list of extensions which are allowed to be uploaded.
# For images you might use something like this:
def extension_white_list
%w(pdf doc docx xls xlsx ppt pptx odt ods odp jpg jpeg png)
['pdf', 'doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx', 'odt', 'ods', 'odp', 'jpg', 'jpeg', 'png']
end
def filename

View file

@ -21,7 +21,7 @@ class ProcedureLogoUploader < BaseUploader
# Add a white list of extensions which are allowed to be uploaded.
# For images you might use something like this:
def extension_white_list
%w(jpg jpeg png)
['jpg', 'jpeg', 'png']
end
def filename

View file

@ -24,10 +24,10 @@ module TPS
config.i18n.load_path += Dir[Rails.root.join('config', 'locales', '**', '*.{rb,yml}')]
config.i18n.available_locales = [:fr]
config.autoload_paths += %W(#{config.root}/lib #{config.root}/app/validators #{config.root}/app/facades)
config.autoload_paths += ["#{config.root}/lib", "#{config.root}/app/validators", "#{config.root}/app/facades"]
config.assets.paths << Rails.root.join('app', 'assets', 'javascript')
config.assets.paths << Rails.root.join('app', 'assets', 'fonts')
config.assets.precompile += %w(.woff)
config.assets.precompile += ['.woff']
URL = ENV['APP_HOST'] || "http://localhost:3000/"

View file

@ -50,7 +50,7 @@ class ActiveJobLogSubscriber < ::ActiveJob::Logging::LogSubscriber
job_id: event.payload[:job].job_id,
queue_name: queue_name(event),
job_class: event.payload[:job].class.to_s,
job_args: args_info(event.payload[:job]),
job_args: args_info(event.payload[:job])
}
end

View file

@ -8,4 +8,4 @@ Rails.application.config.assets.version = '1.0'
# Precompile additional assets.
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
Rails.application.config.assets.precompile += %w(print.css new_design/new_application.css new_design/print.css new_design/application.js new_design/manager.css)
Rails.application.config.assets.precompile += ['print.css', 'new_design/new_application.css', 'new_design/print.css', 'new_design/application.js', 'new_design/manager.css']

View file

@ -11,7 +11,7 @@ CarrierWave.configure do |config|
openstack_api_key: Rails.application.secrets.fog[:openstack_api_key],
openstack_username: Rails.application.secrets.fog[:openstack_username],
openstack_auth_url: Rails.application.secrets.fog[:openstack_auth_url],
openstack_region: Rails.application.secrets.fog[:openstack_region],
openstack_region: Rails.application.secrets.fog[:openstack_region]
}
end

View file

@ -12,7 +12,7 @@ class AddProcedurePathMappingTable < ActiveRecord::Migration
add_foreign_key :procedure_paths, :administrateurs
Procedure.all.each do |procedure|
ProcedurePath.create(path: "#{procedure.id}", procedure_id: procedure.id, administrateur_id: procedure.administrateur.id)
ProcedurePath.create(path: (procedure.id).to_s, procedure_id: procedure.id, administrateur_id: procedure.administrateur.id)
end
end
end

View file

@ -88,7 +88,7 @@ class BuildDefaultPreferenceListDossier < ActiveRecord::Migration
nom_commercial: create_column('Nom commercial', table, 'nom_commercial', 'nom_commercial', 3),
raison_sociale: create_column('Raison sociale', table, 'raison_sociale', 'raison_sociale', 3),
siret_siege_social: create_column('SIRET siège social', table, 'siret_siege_social', 'siret_siege_social', 2),
date_creation: create_column('Date de création', table, 'date_creation', 'date_creation', 2),
date_creation: create_column('Date de création', table, 'date_creation', 'date_creation', 2)
}
end
@ -124,9 +124,7 @@ class BuildDefaultPreferenceListDossier < ActiveRecord::Migration
end
def up
Gestionnaire.all.each do |gestionnaire|
gestionnaire.build_default_preferences_list_dossier
end
Gestionnaire.all.each(&:build_default_preferences_list_dossier)
end
def down

View file

@ -1,6 +1,6 @@
class PurgeDraftDossier < ActiveRecord::Migration
class Dossier < ApplicationRecord
BROUILLON = %w(draft)
BROUILLON = ['draft']
def brouillon?
BROUILLON.include?(state)

View file

@ -47,7 +47,7 @@ class ResetAllPreferenceListDossier < ActiveRecord::Migration
nom_commercial: create_column('Nom commercial', table, 'nom_commercial', 'nom_commercial', 3),
raison_sociale: create_column('Raison sociale', table, 'raison_sociale', 'raison_sociale', 3),
siret_siege_social: create_column('SIRET siège social', table, 'siret_siege_social', 'siret_siege_social', 2),
date_creation: create_column('Date de création', table, 'date_creation', 'date_creation', 2),
date_creation: create_column('Date de création', table, 'date_creation', 'date_creation', 2)
}
end
@ -159,8 +159,6 @@ class ResetAllPreferenceListDossier < ActiveRecord::Migration
end
end
Gestionnaire.all.each do |gestionnaire|
gestionnaire.build_default_preferences_list_dossier
end
Gestionnaire.all.each(&:build_default_preferences_list_dossier)
end
end

View file

@ -1,7 +1,7 @@
class RemoveDuplicateEmailReceived < ActiveRecord::Migration[5.0]
def change
all_mails = MailReceived.all
groupped = all_mails.group_by { |m| m.procedure_id }
groupped = all_mails.group_by(&:procedure_id)
filtered = groupped.reject { |k, v| v.length < 2 }
filtered.each_value do |duplicate_mails|
duplicate_mails.pop

View file

@ -119,7 +119,7 @@ module Cellar
doc = Nokogiri::XML(bucket_listing_xml)
doc
.xpath('//xmlns:Contents/xmlns:Key')
.map{ |k| k.text }
.map(&:text)
end
def bulk_deletion_request_body(keys)

View file

@ -13,7 +13,7 @@ module Mailers
if procedures.count == 1
procedure_ids = "votre démarche nº #{procedures.first.id}"
else
procedure_ids = 'vos démarches nº ' + procedures.map{ |p| p.id }.join(', ')
procedure_ids = 'vos démarches nº ' + procedures.map(&:id).join(', ')
end
"demarches-simplifiees.fr mise à jour nécessaire de laccusé dacceptation de #{procedure_ids}"
end

View file

@ -24,7 +24,7 @@ namespace :'2017_10_30_copy_commentaire_piece_justificative_to_file' do
def sanitize_name(name) # from https://github.com/carrierwaveuploader/carrierwave/blob/master/lib/carrierwave/sanitized_file.rb#L323
name = name.gsub(/[^[:word:]\.\-\+]/,"_")
name = "_#{name}" if name.match?(/\A\.+\z/)
name = "unnamed" if name.size == 0
name = "unnamed" if name.empty?
return name.mb_chars.to_s
end

View file

@ -23,7 +23,7 @@ namespace :'2017_12_04_translate_dossier_state_to_french' do
Dossier.unscoped.where(state: 'without_continuation').update_all(state: 'sans_suite')
end
task all: %i(brouillon en_construction en_instruction accepte refuse sans_suite) do
task all: [:brouillon, :en_construction, :en_instruction, :accepte, :refuse, :sans_suite] do
end
task revert: :environment do

View file

@ -2,7 +2,7 @@ require Rails.root.join("lib", "tasks", "task_helper")
namespace :'2018_01_18_clean_datetime_in_champs' do
task clean: :environment do
datetime_champs = TypeDeChamp.where(type_champ: "datetime").flat_map{ |t| t.champ }
datetime_champs = TypeDeChamp.where(type_champ: "datetime").flat_map(&:champ)
# Match " HH:MM" => nil a datetime is not valid if not composed by date AND time
datetime_champs.select { |c| /^\s\d{2}:\d{2}$/.match(c.value) }.each do |c|

View file

@ -1,7 +1,5 @@
namespace :'2018_06_04_scan_pjs' do
task scan_all: :environment do
Champs::PieceJustificativeChamp.all.each do |pj_champ|
pj_champ.create_virus_scan
end
Champs::PieceJustificativeChamp.all.each(&:create_virus_scan)
end
end

View file

@ -3,7 +3,7 @@ require Rails.root.join("lib", "tasks", "task_helper")
namespace :'2018_06_06_users_for_admins_and_gestionnaires' do
task preactivate: :environment do
preactivate_users(Gestionnaire, 'accompagnateur') { |g| g.reset_password_token.nil? }
preactivate_users(Administrateur) { |a| a.active? }
preactivate_users(Administrateur, &:active?)
end
def preactivate_users(model, role_name = nil, &block)

View file

@ -1,5 +1,5 @@
task :deploy do
domains = %w(149.202.72.152 149.202.198.6)
domains = ['149.202.72.152', '149.202.198.6']
domains.each do |domain|
sh "mina deploy domain=#{domain}"
end

View file

@ -45,7 +45,7 @@ namespace :support do
if user.dossiers.state_instruction_commencee.any?
fail "Cannot delete this user because instruction has started for some dossiers"
end
user.dossiers.each { |d| d.delete_and_keep_track }
user.dossiers.each(&:delete_and_keep_track)
user.destroy
end
end

View file

@ -113,7 +113,7 @@ describe ApplicationController, type: :controller do
it { expect(@controller).to have_received(:redirect_to).with(root_path) }
context 'when the path is safe' do
%w(/ /manager /administrations).each do |path|
['/', '/manager', '/administrations'].each do |path|
let(:path_info) { path }
it { expect(@controller).not_to have_received(:sign_out) }

View file

@ -15,7 +15,7 @@ describe Champs::DossierLinkController, type: :controller do
{
dossier: {
champs_attributes: {
'1' => { value: "#{dossier_id}" }
'1' => { value: dossier_id.to_s }
}
},
position: '1'

View file

@ -10,7 +10,7 @@ describe Champs::SiretController, type: :controller do
{
dossier: {
champs_attributes: {
'1' => { value: "#{siret}" }
'1' => { value: siret.to_s }
}
},
position: '1'

View file

@ -165,8 +165,8 @@ describe StatsController, type: :controller do
Dossier.update_all(state: Dossier.states.fetch(:accepte))
@expected_hash = {
"#{2.months.ago.beginning_of_month}" => 3.0,
"#{1.month.ago.beginning_of_month}" => 5.0
(2.months.ago.beginning_of_month).to_s => 3.0,
(1.month.ago.beginning_of_month).to_s => 5.0
}
end
@ -217,8 +217,8 @@ describe StatsController, type: :controller do
Dossier.update_all(state: Dossier.states.fetch(:accepte))
@expected_hash = {
"#{2.months.ago.beginning_of_month}" => 30.0,
"#{1.month.ago.beginning_of_month}" => 50.0
(2.months.ago.beginning_of_month).to_s => 30.0,
(1.month.ago.beginning_of_month).to_s => 50.0
}
end

View file

@ -24,7 +24,7 @@ describe SupportController, type: :controller do
get :index, params: { dossier_id: dossier.id }
expect(response.status).to eq(200)
expect(response.body).to include("#{dossier.id}")
expect(response.body).to include((dossier.id).to_s)
end
end

View file

@ -22,7 +22,7 @@ describe Users::PasswordsController, type: :controller do
user: {
reset_password_token: @token,
password: "mot de passe super secret",
password_confirmation: "mot de passe super secret",
password_confirmation: "mot de passe super secret"
}
}
expect(subject.current_user).to eq(user)
@ -34,7 +34,7 @@ describe Users::PasswordsController, type: :controller do
user: {
reset_password_token: @token,
password: "mot de passe super secret",
password_confirmation: "mot de passe super secret",
password_confirmation: "mot de passe super secret"
}
}
expect(subject.current_user).to eq(user)

View file

@ -47,7 +47,7 @@ describe 'CellarService' do
'Expires' => ['1475366700'],
'Signature' => ['nzCsB6cip8oofkuOdvvJs6FafkA='],
'response-content-disposition' => ["attachment; filename=\"toto.png\"; filename*=UTF-8''toto.png"],
'response-content-type' => ['image/png'],
'response-content-type' => ['image/png']
}
)
end

View file

@ -23,7 +23,7 @@ describe Dossier do
end
it do
expect(Dossier.with_champs.find(dossier.id).champs.map(&:libelle)).to match(%w(l1 l2 l3))
expect(Dossier.with_champs.find(dossier.id).champs.map(&:libelle)).to match(['l1', 'l2', 'l3'])
end
end
@ -379,7 +379,7 @@ describe Dossier do
create(:type_de_champ, libelle: 'l2', order_place: 2, procedure: procedure)
end
it { expect(dossier.champs.pluck(:libelle)).to match(%w(l1 l2 l3)) }
it { expect(dossier.champs.pluck(:libelle)).to match(['l1', 'l2', 'l3']) }
end
describe '#champs_private' do
@ -392,7 +392,7 @@ describe Dossier do
create :type_de_champ, :private, libelle: 'l2', order_place: 2, procedure: procedure
end
it { expect(dossier.champs_private.pluck(:libelle)).to match(%w(l1 l2 l3)) }
it { expect(dossier.champs_private.pluck(:libelle)).to match(['l1', 'l2', 'l3']) }
end
describe '#total_follow' do

View file

@ -753,7 +753,7 @@ describe Procedure do
p = create(
:procedure,
juridique_required: false,
cadre_juridique: nil,
cadre_juridique: nil
)
expect(p.juridique_required).to be_falsey

View file

@ -39,7 +39,7 @@ end
Capybara.register_driver :headless_chrome do |app|
capabilities = Selenium::WebDriver::Remote::Capabilities.chrome(
chromeOptions: { args: %w(headless disable-gpu disable-dev-shm-usage disable-software-rasterizer mute-audio window-size=1440,900) }
chromeOptions: { args: ['headless', 'disable-gpu', 'disable-dev-shm-usage', 'disable-software-rasterizer', 'mute-audio', 'window-size=1440,900'] }
)
Capybara::Selenium::Driver.new app,

View file

@ -1,5 +1,5 @@
RSpec.configure do |config|
expect_list = %w()
expect_list = []
config.before(:suite) do
DatabaseCleaner.clean_with(:truncation, except: expect_list)

View file

@ -5,7 +5,7 @@ describe 'new_gestionnaire/dossiers/envoyer_dossier_block.html.haml', type: :vie
render(
'new_gestionnaire/dossiers/envoyer_dossier_block.html.haml',
dossier: dossier,
potential_recipients: potential_recipients,
potential_recipients: potential_recipients
)
end