Merge pull request #422 from sgmap/rubocop

Rubocop
This commit is contained in:
gregoirenovel 2017-06-13 10:38:09 +02:00 committed by GitHub
commit a74ac79489
214 changed files with 1516 additions and 661 deletions

1059
.rubocop.yml Normal file

File diff suppressed because it is too large Load diff

View file

@ -417,6 +417,7 @@ GEM
openstack (3.3.7)
json
orm_adapter (0.5.0)
parallel (1.11.2)
parser (2.4.0.0)
ast (~> 2.2)
pg (0.19.0)
@ -471,7 +472,8 @@ GEM
method_source
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
rainbow (2.2.1)
rainbow (2.2.2)
rake
raindrops (0.17.0)
rake (12.0.0)
rb-fsevent (0.9.8)
@ -522,7 +524,8 @@ GEM
rspec-mocks (~> 3.5.0)
rspec-support (~> 3.5.0)
rspec-support (3.5.0)
rubocop (0.48.1)
rubocop (0.49.1)
parallel (~> 1.10)
parser (>= 2.3.3.1, < 3.0)
powerpack (~> 0.1)
rainbow (>= 1.99.1, < 3.0)
@ -618,7 +621,7 @@ GEM
unf (0.1.4)
unf_ext
unf_ext (0.0.7.2)
unicode-display_width (1.1.3)
unicode-display_width (1.2.1)
unicode_utils (1.4.0)
unicorn (5.2.0)
kgio (~> 2.6)

View file

@ -24,7 +24,6 @@
# * zeus: 'zeus rspec' (requires the server to be started separetly)
# * 'just' rspec: 'rspec'
guard 'livereload' do
extensions = {
css: :css,

View file

@ -19,7 +19,6 @@ task :deploy_ha do
end
end
task :deploy_old do
domains = %w(37.187.154.237 37.187.249.111)
domains.each do |domain|
@ -27,7 +26,6 @@ task :deploy_old do
end
end
task :deploy_test do
domains = %w(192.168.0.116)
branch = 'clamav'

View file

@ -7,10 +7,10 @@ class Admin::GestionnairesController < AdminController
current_administrateur.gestionnaires,
partial: "admin/gestionnaires/list",
array: true
@gestionnaire ||= Gestionnaire.new
end
def create
@gestionnaire = Gestionnaire.find_by_email(params[:gestionnaire][:email])
procedure_id = params[:procedure_id]

View file

@ -40,7 +40,6 @@ class Admin::ProceduresController < AdminController
end
def edit
end
def destroy

View file

@ -11,8 +11,6 @@ class AdministrationsController < ApplicationController
Administrateur.all.order(:email),
partial: "administrations/list",
array: true
end
def create

View file

@ -13,5 +13,4 @@ class API::V1::ProceduresController < APIController
Rails.logger.error(e.message)
render json: {}, status: 404
end
end

View file

@ -1,5 +1,4 @@
class Backoffice::AvisController < ApplicationController
before_action :authenticate_gestionnaire!, except: [:sign_up, :create_gestionnaire]
before_action :redirect_if_no_sign_up_needed, only: [:sign_up]
before_action :check_avis_exists_and_email_belongs_to_avis, only: [:sign_up, :create_gestionnaire]

View file

@ -21,5 +21,4 @@ class Backoffice::Dossiers::ProcedureController < Backoffice::DossiersListContro
def retrieve_procedure
current_gestionnaire.procedures.find params[:id]
end
end

View file

@ -172,7 +172,6 @@ class Backoffice::DossiersController < Backoffice::DossiersListController
redirect_to backoffice_dossiers_path
end
def unarchive
@dossier = Dossier.find(params[:id])
if @dossier.archived

View file

@ -31,7 +31,6 @@ class Backoffice::DossiersListController < ApplicationController
dossiers_list_facade liste
service = dossiers_list_facade.service
if param_page.nil?
params[:dossiers_smart_listing] = {page: dossiers_list_facade.service.default_page}
end

View file

@ -1,5 +1,4 @@
class CguController < ApplicationController
def index
end
end

View file

@ -1,4 +1,3 @@
class DossiersDecorator < Draper::CollectionDecorator
delegate :current_page, :per_page, :offset, :total_entries, :total_pages
end

View file

@ -1,4 +1,3 @@
class EtablissementDecorator < Draper::Decorator
delegate_all
end

View file

@ -1,5 +1,4 @@
class ProcedureDecorator < Draper::Decorator
delegate_all
def lien

View file

@ -1,4 +1,3 @@
class ProceduresDecorator < Draper::CollectionDecorator
delegate :current_page, :per_page, :offset, :total_entries, :total_pages
end

View file

@ -1,5 +1,4 @@
class TypeDeChampDecorator < Draper::Decorator
delegate_all
def button_up params

View file

@ -1,3 +1,2 @@
class TypeDeChampPrivateDecorator < TypeDeChampDecorator
end

View file

@ -1,5 +1,4 @@
class DossierFacades
#TODO rechercher en fonction de la personne/email
def initialize(dossier_id, email, champ_id = nil)
@dossier = Dossier.find(dossier_id)

View file

@ -80,5 +80,4 @@ class DossiersListFacades
def base_url liste
@procedure.nil? ? backoffice_dossiers_path(liste: liste) : backoffice_dossiers_procedure_path(id: @procedure.id, liste: liste)
end
end

View file

@ -1,5 +1,4 @@
class InviteDossierFacades < DossierFacades
#TODO rechercher en fonction de la personne/email
def initialize id, email
@dossier = Invite.where(email: email, id: id).first!.dossier

View file

@ -1,7 +1,6 @@
module Carto
module GeoAPI
class Driver
def self.regions
call regions_url
end
@ -29,7 +28,6 @@ module Carto
rescue RestClient::ServiceUnavailable
nil
end
end
end
end

View file

@ -12,7 +12,6 @@ class SIADE::RNAAdapter
data_source[:association].each do |k, v|
params[k] = v if attr_to_fetch.include?(k)
end
params[:association_id] = params[:id]

View file

@ -1,9 +1,7 @@
class AvisMailer < ApplicationMailer
def avis_invitation(avis)
@avis = avis
email = @avis.gestionnaire.try(:email) || @avis.email
mail(to: email, subject: "Donnez votre avis sur le dossier nº #{@avis.dossier.id} (#{@avis.dossier.procedure.libelle})")
end
end

View file

@ -1,5 +1,4 @@
class GestionnaireMailer < ApplicationMailer
def new_gestionnaire email, password
send_mail email, password, "Vous avez été nommé accompagnateur sur la plateforme TPS"
end

View file

@ -1,5 +1,4 @@
class InviteMailer < ApplicationMailer
def invite_user invite
vars_mailer invite

View file

@ -1,6 +1,5 @@
class NewAdminMailer < ApplicationMailer
def new_admin_email admin, password
@admin = admin
@password = password

View file

@ -1,6 +1,5 @@
class WelcomeMailer < ApplicationMailer
def welcome_email user
@user = user
mail(to: user.email,

View file

@ -1,3 +1,2 @@
class ChampPrivate < Champ
end

View file

@ -1,3 +1,2 @@
class ChampPublic < Champ
end

View file

@ -15,5 +15,4 @@ module CredentialsSyncableConcern
def force_sync_credentials
SyncCredentialsService.new(self.class, email_was, email, encrypted_password).change_credentials!
end
end

View file

@ -52,10 +52,8 @@ class Gestionnaire < ActiveRecord::Base
end
def build_default_preferences_list_dossier procedure_id=nil
PreferenceListDossier.available_columns_for(procedure_id).each do |table|
table.second.each do |column|
if valid_couple_table_attr? table.first, column.first
PreferenceListDossier.create(
libelle: column.second[:libelle],

View file

@ -1,5 +1,4 @@
class Invite < ActiveRecord::Base
belongs_to :dossier
belongs_to :user

View file

@ -1,3 +1,2 @@
class InviteGestionnaire < Invite
end

View file

@ -1,3 +1,2 @@
class InviteUser < Invite
end

View file

@ -88,7 +88,8 @@ class Procedure < ActiveRecord::Base
def clone
procedure = self.deep_clone(include:
[:types_de_piece_justificative,
[
:types_de_piece_justificative,
:types_de_champ,
:types_de_champ_private,
:module_api_carto,

View file

@ -1,3 +1,2 @@
class TypeDeChampPrivate < TypeDeChamp
end

View file

@ -1,3 +1,2 @@
class TypeDeChampPublic < TypeDeChamp
end

View file

@ -11,5 +11,4 @@ class EtablissementSerializer < ActiveModel::Serializer
:code_postal,
:localite,
:code_insee_localite
end

View file

@ -2,6 +2,4 @@ class ModuleApiCartoSerializer < ActiveModel::Serializer
attributes :use_api_carto,
:quartiers_prioritaires,
:cadastre
end

View file

@ -10,7 +10,6 @@ class ProcedureSerializer < ActiveModel::Serializer
:geographic_information,
:total_dossier
has_one :geographic_information, serializer: ModuleApiCartoSerializer
has_many :types_de_champ, serializer: TypeDeChampSerializer
has_many :types_de_champ_private, serializer: TypeDeChampSerializer

View file

@ -1,5 +1,4 @@
class BrowserService
def self.get_browser request
BROWSER.value = Browser.new(request.user_agent)
end
@ -15,5 +14,4 @@ class BrowserService
true
end
end

View file

@ -1,6 +1,5 @@
class ClamavService
def self.safe_file? path_file
if Rails.env == 'development'
return CLAMAV[:response] if CLAMAV[:mock?]
end

View file

@ -1,5 +1,4 @@
class DossierService
def initialize dossier, siret, france_connect_information
@dossier = dossier
@siret = siret
@ -34,7 +33,6 @@ class DossierService
@dossier
end
def self.siren siret
siret[0..8]
end

View file

@ -13,7 +13,6 @@ class DossiersListGestionnaireService
'termine' => termine,
'archive' => archive,
'all_state' => all_state}[@liste]
end
def self.dossiers_liste_libelle
@ -186,5 +185,4 @@ class DossiersListGestionnaireService
def current_preference_smart_listing_page
@current_devise_profil.preference_smart_listing_page
end
end

View file

@ -1,5 +1,4 @@
class FranceConnectSaltService
attr_reader :model
def initialize france_connect_information

View file

@ -11,7 +11,6 @@ class GeojsonService
end
def self.to_json_polygon_for_cadastre coordinates
polygon = {
geom: {
type: "Feature",

View file

@ -26,12 +26,14 @@ class ModuleApiCartoService
def self.generate_qp coordinates
coordinates.inject({}) { |acc, coordinate|
acc.merge CARTO::SGMAP::QuartiersPrioritaires::Adapter.new(
coordinate.map { |element| [element['lng'], element['lat']] }).to_params }
coordinate.map { |element| [element['lng'], element['lat']] }).to_params
}
end
def self.generate_cadastre coordinates
(coordinates.inject([]) { |acc, coordinate|
acc << CARTO::SGMAP::Cadastre::Adapter.new(
coordinate.map { |element| [element['lng'], element['lat']] }).to_params }).flatten
coordinate.map { |element| [element['lng'], element['lat']] }).to_params
}).flatten
end
end

View file

@ -1,5 +1,4 @@
class NotificationService
def initialize type_notif, dossier_id, attribut_change=''
@type_notif = type_notif
@dossier_id = dossier_id

View file

@ -1,5 +1,4 @@
class RenderPartialService
attr_accessor :controller, :method
def initialize controller, method

View file

@ -1,5 +1,4 @@
class SyncCredentialsService
def initialize klass, email_was, email, encrypted_password
@klass = klass
@email_was = email_was

View file

@ -7,7 +7,6 @@ class TypesDeChampService
.permit("#{attributes}" => [:libelle, :description, :order_place, :type_champ, :id, :mandatory, :type,
drop_down_list_attributes: [:value, :id]])
parameters[attributes].each do |param_first, param_second|
if param_second[:libelle].empty?
parameters[attributes].delete(param_first.to_s)

View file

@ -1,5 +1,4 @@
class UserRoutesAuthorizationService
def self.authorized_route? controller, dossier
auth = controller.route_authorization

View file

@ -1,7 +1,6 @@
# encoding: utf-8
class ProcedureLogoUploader < BaseUploader
def root
File.join(Rails.root, "public")
end
@ -47,5 +46,4 @@ class ProcedureLogoUploader < BaseUploader
def generate_secure_token
SecureRandom.uuid
end
end

View file

@ -1,5 +1,4 @@
class EmailFormatValidator < ActiveModel::Validator
def email_regex
/\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i
end

View file

@ -1,5 +1,4 @@
class ProcedurePathFormatValidator < ActiveModel::Validator
def path_regex
/^[a-z0-9_]{3,30}$/
end
@ -8,5 +7,4 @@ class ProcedurePathFormatValidator < ActiveModel::Validator
return false if record.path.blank?
record.errors[:path] << "Path invalide" unless path_regex.match(record.path)
end
end

View file

@ -9,6 +9,7 @@ class SiretFormatValidator < ActiveModel::EachValidator
end
private
def luhn_checksum(value)
accum = 0
value.reverse.each_char.map(&:to_i).each_with_index do |digit, index|

View file

@ -15,7 +15,6 @@ raise "Bad to=#{+ENV['to']}" unless ["staging", "production"].include?(ENV['to']
raise "missing domain, run with 'rake deploy domain=37.187.154.237'" if ENV['domain'].nil?
# set :domain, '5.135.190.60'
set :domain, ENV['domain']
set :repository, 'https://github.com/sgmap/tps.git'
@ -72,7 +71,6 @@ set :shared_paths, [
'app/views/cgu/index.html.haml'
]
set :rbenv_path, "/usr/local/rbenv/bin/rbenv"
# Optional settings:

View file

@ -14,5 +14,4 @@ Apipie.configure do |config|
Description
EOS
end

View file

@ -1,9 +1,7 @@
require "unicode_utils/upcase"
class String
def upcase
UnicodeUtils.upcase(self)
end
end

View file

@ -1,5 +1,4 @@
Rails.application.routes.draw do
get "/ping" => "ping#index", :constraints => {:ip => /127.0.0.1/}
devise_for :administrations, skip: [:password, :registrations]
@ -144,7 +143,6 @@ Rails.application.routes.draw do
resource :accompagnateurs, only: [:show, :update]
resource :previsualisation, only: [:show]
end
namespace :accompagnateurs do

View file

@ -8,8 +8,6 @@
# See http://unicorn.bogomips.org/Unicorn/Configurator.html for complete
# documentation.
# Use at least one worker per core if you're on a dedicated server,
# more will usually help for _short_ waits on databases/caches.
worker_processes 2
@ -52,7 +50,6 @@ check_client_connection false
# local variable to guard against running a hook multiple times
run_once = true
before_fork do |server, worker|
# the following is highly recomended for Rails + "preload_app true"
# as there's no need for the master process to hold a connection

View file

@ -13,7 +13,6 @@ class CreateEntreprise < ActiveRecord::Migration
t.integer :date_creation
t.string :nom
t.string :prenom
end
add_reference :entreprises, :dossier, references: :dossiers
end

View file

@ -30,7 +30,6 @@ class DeviseCreateUsers < ActiveRecord::Migration
# t.string :unlock_token # Only if unlock strategy is :email or :both
# t.datetime :locked_at
t.timestamps
end

View file

@ -30,7 +30,6 @@ class DeviseCreatePros < ActiveRecord::Migration
# t.string :unlock_token # Only if unlock strategy is :email or :both
# t.datetime :locked_at
t.timestamps
end

View file

@ -30,7 +30,6 @@ class DeviseCreateGestionnaires < ActiveRecord::Migration
# t.string :unlock_token # Only if unlock strategy is :email or :both
# t.datetime :locked_at
t.timestamps
end

View file

@ -30,7 +30,6 @@ class CreateUsers < ActiveRecord::Migration
# t.string :unlock_token # Only if unlock strategy is :email or :both
# t.datetime :locked_at
t.timestamps
end

View file

@ -30,7 +30,6 @@ class DeviseCreateAdministrateurs < ActiveRecord::Migration
# t.string :unlock_token # Only if unlock strategy is :email or :both
# t.datetime :locked_at
t.timestamps
end

View file

@ -1,6 +1,5 @@
class ChangeStateConfirmedToValidated < ActiveRecord::Migration
def change
Dossier.where(state: 'confirmed').update_all(state: 'validated')
end
end

View file

@ -7,6 +7,5 @@ class DeleteAttributsToDossier < ActiveRecord::Migration
remove_column :dossiers, :position_lon
remove_column :dossiers, :ref_dossier_carto
end
end

View file

@ -1,11 +1,8 @@
class UpdateModuleAPICarto < ActiveRecord::Migration
class Procedure < ActiveRecord::Base
end
class ModuleAPICarto < ActiveRecord::Base
end
def up

View file

@ -1,11 +1,8 @@
class CreateFranceConnectInformation < ActiveRecord::Migration
class User < ActiveRecord::Base
end
class FranceConnectInformation < ActiveRecord::Base
end
def up
@ -38,7 +35,6 @@ class CreateFranceConnectInformation < ActiveRecord::Migration
remove_column :users, :france_connect_particulier_id
end
def down
add_column :users, :gender, :string
add_column :users, :given_name, :string

View file

@ -30,7 +30,6 @@ class DeviseCreateAdministrations < ActiveRecord::Migration
# t.string :unlock_token # Only if unlock strategy is :email or :both
# t.datetime :locked_at
t.timestamps
end

View file

@ -8,7 +8,6 @@ class PieceJustificativeHaveUser < ActiveRecord::Migration
end
class User < ActiveRecord::Base
end
def change

View file

@ -8,7 +8,6 @@ class CerfaHaveUser < ActiveRecord::Migration
end
class User < ActiveRecord::Base
end
def change

View file

@ -1,10 +1,8 @@
class SetOriginalFilenameForUploaders < ActiveRecord::Migration
class PieceJustificative < ActiveRecord::Base
end
class Cerfa < ActiveRecord::Base
end
def change

View file

@ -1,18 +1,14 @@
class DeleteDefaultDescriptionToDossier < ActiveRecord::Migration
class Dossier < ActiveRecord::Base
end
class Champ < ActiveRecord::Base
end
class Procedure < ActiveRecord::Base
end
class TypeDeChamp < ActiveRecord::Base
end
def up

View file

@ -1,7 +1,5 @@
class ConvertAllDatetimeToDateOnDatabase < ActiveRecord::Migration
class TypeDeChamp < ActiveRecord::Base
end
def change

View file

@ -1,10 +1,8 @@
class BuildDefaultPreferenceListDossier < ActiveRecord::Migration
class Gestionnaire < ActiveRecord::Base
def build_default_preferences_list_dossier
PreferenceListDossier.available_columns.each do |table|
table.second.each do |column|
if valid_couple_table_attr? table.first, column.first
PreferenceListDossier.create(
libelle: column.second[:libelle],

View file

@ -1,6 +1,5 @@
class FixDefaultTypeOnTypeDeChampTable < ActiveRecord::Migration
class TypeDeChamp < ActiveRecord::Base
end
def up

View file

@ -1,5 +1,4 @@
class AddTypeAttrInChampTable < ActiveRecord::Migration
class TypeDeChamp < ActiveRecord::Base
has_many :champs
end

View file

@ -1,6 +1,5 @@
class DeleteValueOfFilterProcedure < ActiveRecord::Migration
class Gestionnaire < ActiveRecord::Base
end
def change

View file

@ -4,7 +4,6 @@ class InitiatedAllReceivedMailForProcedure < ActiveRecord::Migration
end
class MailTemplate < ActiveRecord::Base
end
class ::MailReceived < MailTemplate

View file

@ -1,6 +1,5 @@
class ChangeEmptytoNilInPreferenceListDossierTable < ActiveRecord::Migration
class PreferenceListDossier < ActiveRecord::Base
end
def change

View file

@ -1,6 +1,5 @@
class FixTypeDeChampHeaderSectionWithMandatoryTrue < ActiveRecord::Migration
class TypeDeChamp < ActiveRecord::Base
end
def change

View file

@ -96,10 +96,8 @@ class ResetAllPreferenceListDossier < ActiveRecord::Migration
has_many :procedures, through: :assign_to
def build_default_preferences_list_dossier procedure_id=nil
PreferenceListDossier.available_columns_for(procedure_id).each do |table|
table.second.each do |column|
if valid_couple_table_attr? table.first, column.first
PreferenceListDossier.create(
libelle: column.second[:libelle],
@ -144,7 +142,6 @@ class ResetAllPreferenceListDossier < ActiveRecord::Migration
class Procedure < ActiveRecord::Base
has_many :assign_to, dependent: :destroy
has_many :gestionnaires, through: :assign_to
end
def change

View file

@ -1,14 +1,12 @@
class CreateNotification < ActiveRecord::Migration[5.0]
def change
create_table :notifications do |t|
t.boolean :already_read, default: false
t.string :liste, array: true
t.boolean :multiple, default: false
t.string :type_notif
t.datetime :created_at
t.datetime :updated_at
end
add_belongs_to :notifications, :dossier

View file

@ -11,7 +11,6 @@
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20170523092900) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@ -475,5 +474,4 @@ ActiveRecord::Schema.define(version: 20170523092900) do
LEFT JOIN individuals ON ((individuals.dossier_id = dossiers.id)))
LEFT JOIN pieces_justificatives ON ((pieces_justificatives.dossier_id = dossiers.id)));
SQL
end

View file

@ -1,5 +1,4 @@
namespace :cloudstorage do
task init: :environment do
os_config = (YAML.load_file(Fog.credentials_path))['default']
@os = OpenStack::Connection.create(
@ -91,7 +90,6 @@ namespace :cloudstorage do
}
end
desc 'Clear old documents in tenant'
task :clear do
Rake::Task['cloudstorage:init'].invoke
@ -110,5 +108,4 @@ namespace :cloudstorage do
@cont.delete_object(object) unless last_modified.utc > (Time.now - 2.year).utc
}
end
end

View file

View file

@ -12,5 +12,4 @@ describe Admin::PrevisualisationsController, type: :controller do
subject { get :show, params: {procedure_id: procedure.id} }
it { expect(subject.status).to eq(200) }
end
end

View file

@ -31,7 +31,6 @@ describe Admin::ProceduresController, type: :controller do
}
}
before do
sign_in admin
end
@ -55,7 +54,6 @@ describe Admin::ProceduresController, type: :controller do
end
describe 'DELETE #destroy' do
let(:procedure_draft) { create :procedure, published: false, archived: false }
let(:procedure_published) { create :procedure, published: true, archived: false }
let(:procedure_archived) { create :procedure, published: false, archived: true }
@ -151,7 +149,6 @@ describe Admin::ProceduresController, type: :controller do
it { expect(subject.direction).to eq(direction) }
it { expect(subject.lien_demarche).to eq(lien_demarche) }
it { expect(subject.administrateur_id).to eq(admin.id) }
end
describe 'procedure module api carto attributs in database' do
@ -279,7 +276,6 @@ describe Admin::ProceduresController, type: :controller do
it { expect(subject.for_individual).not_to eq procedure_params[:for_individual] }
it { expect(subject.individual_with_siret).not_to eq procedure_params[:individual_with_siret] }
it { expect(subject.use_api_carto).not_to eq procedure_params[:module_api_carto_attributes][:use_api_carto] }
end
end
end
@ -466,7 +462,6 @@ describe Admin::ProceduresController, type: :controller do
it { expect(body.first['mine']).to be_truthy }
it { expect(body.second['label']).to eq(procedure2.path) }
it { expect(body.second['mine']).to be_falsy }
end
context 'filtered' do
@ -483,7 +478,6 @@ describe Admin::ProceduresController, type: :controller do
end
context 'when procedure is archived' do
before do
procedure3.update_attribute :archived, true
subject

View file

@ -1,11 +1,9 @@
require 'spec_helper'
describe AdministrationsController, type: :controller do
let(:administration) { create :administration }
describe 'GET #index' do
subject { get :index }
context 'when administration user is not connect' do
@ -13,7 +11,6 @@ describe AdministrationsController, type: :controller do
end
context 'when administration user is connect' do
before do
sign_in administration
end
@ -23,7 +20,6 @@ describe AdministrationsController, type: :controller do
end
describe 'POST #create' do
let(:email) { 'plop@plop.com' }
let(:password) { 'password' }
@ -43,7 +39,6 @@ describe AdministrationsController, type: :controller do
expect(NewAdminMailer).to receive(:deliver_now!)
subject
end
end
context 'when email or password are missing' do

View file

@ -2,7 +2,6 @@ require 'spec_helper'
describe API::StatistiquesController, type: :controller do
describe '#GET dossiers_stats' do
before do
get :dossiers_stats
end

View file

@ -95,7 +95,6 @@ describe API::V1::DossiersController do
end
context 'when procedure is found and belongs to current admin' do
context 'when dossier does not exist' do
let(:procedure_id) { procedure.id }
let(:dossier_id) { 99999 }
@ -144,7 +143,8 @@ describe API::V1::DossiersController do
:code_effectif_entreprise,
:date_creation,
:nom,
:prenom] }
:prenom]
}
subject { super()[:entreprise] }
it { expect(subject[:siren]).to eq('440117620') }
@ -164,7 +164,8 @@ describe API::V1::DossiersController do
let(:field_list) { [
:id,
:libelle,
:description] }
:description]
}
subject { super()[:types_de_piece_justificative] }
it { expect(subject.length).to eq 2 }
@ -184,9 +185,9 @@ describe API::V1::DossiersController do
end
let(:field_list) { [
:url, :created_at, :type_de_piece_justificative_id] }
subject {
super()[:pieces_justificatives].first }
:url, :created_at, :type_de_piece_justificative_id]
}
subject { super()[:pieces_justificatives].first }
it { expect(subject.keys.include?(:content_url)).to be_truthy }
it { expect(subject[:created_at]).not_to be_nil }
@ -203,7 +204,8 @@ describe API::V1::DossiersController do
describe 'champs' do
let(:field_list) { [
:url] }
:url]
}
subject { super()[:champs] }
it { expect(subject.length).to eq 1 }
@ -220,7 +222,8 @@ describe API::V1::DossiersController do
:libelle,
:description,
:order_place,
:type] }
:type]
}
subject { super()[:type_de_champ] }
it { expect(subject.keys.include?(:id)).to be_truthy }
@ -234,7 +237,8 @@ describe API::V1::DossiersController do
describe 'champs_private' do
let(:field_list) { [
:url] }
:url]
}
subject { super()[:champs_private] }
it { expect(subject.length).to eq 1 }
@ -251,7 +255,8 @@ describe API::V1::DossiersController do
:libelle,
:description,
:order_place,
:type] }
:type]
}
subject { super()[:type_de_champ] }
it { expect(subject.keys.include?(:id)).to be_truthy }
@ -298,9 +303,9 @@ describe API::V1::DossiersController do
describe 'user' do
let(:field_list) { [
:url, :created_at, :type_de_piece_justificative_id] }
subject {
super()[:user] }
:url, :created_at, :type_de_piece_justificative_id]
}
subject { super()[:user] }
it { expect(subject[:email]).not_to be_nil }
end
@ -320,7 +325,8 @@ describe API::V1::DossiersController do
:code_postal,
:localite,
:code_insee_localite
] }
]
}
subject { super()[:etablissement] }
it { expect(subject[:siret]).to eq('44011762001530') }

View file

@ -1,7 +1,6 @@
require 'spec_helper'
describe Backoffice::AvisController, type: :controller do
describe '#POST create' do
let(:gestionnaire){ create(:gestionnaire) }
let!(:dossier){ create(:dossier, state: 'received') }

View file

@ -181,7 +181,6 @@ describe Backoffice::DossiersController, type: :controller do
end
end
describe 'POST #search' do
describe 'by id' do
context 'when I am logged as a gestionnaire' do
@ -284,7 +283,6 @@ describe Backoffice::DossiersController, type: :controller do
end
subject { post :without_continuation, params: {dossier_id: dossier_id} }
it 'change state to without_continuation' do
subject
@ -348,7 +346,6 @@ describe Backoffice::DossiersController, type: :controller do
it 'change state for updated' do
expect(dossier.state).to eq 'updated'
end
end
describe 'flash alert' do

View file

@ -14,11 +14,14 @@ describe Backoffice::PreferenceListDossierController, type: :controller do
describe '#POST add' do
subject { post :add,
params: {libelle: libelle,
params: {
libelle: libelle,
table: table,
attr: attr,
attr_decorate: attr_decorate,
bootstrap_lg: bootstrap_lg} }
bootstrap_lg: bootstrap_lg
}
}
it { expect(subject.status).to eq 200 }
it { expect { subject }.to change(PreferenceListDossier, :count).by(1) }

View file

@ -13,10 +13,13 @@ describe Backoffice::PrivateFormulairesController, type: :controller do
describe '#PATCH update' do
subject { patch :update,
params: {dossier_id: dossier.id,
params: {
dossier_id: dossier.id,
champs: {
"'#{dossier.champs_private.first.id}'" => dossier_champs_first
}} }
}
}
}
before do
subject

Some files were not shown because too many files have changed in this diff Show more