Enable the Layout/SpaceBeforeBlockBraces cop
This commit is contained in:
parent
8b0b8162f0
commit
386fbce776
25 changed files with 53 additions and 53 deletions
|
@ -224,7 +224,7 @@ Layout/SpaceAroundOperators:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
|
||||||
Layout/SpaceBeforeBlockBraces:
|
Layout/SpaceBeforeBlockBraces:
|
||||||
Enabled: false
|
Enabled: true
|
||||||
|
|
||||||
Layout/SpaceBeforeComma:
|
Layout/SpaceBeforeComma:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
|
|
@ -6,7 +6,7 @@ class API::V1::DossiersController < APIController
|
||||||
def index
|
def index
|
||||||
dossiers = @dossiers.page(params[:page]).per(per_page)
|
dossiers = @dossiers.page(params[:page]).per(per_page)
|
||||||
|
|
||||||
render json: { dossiers: dossiers.map{ |dossier| DossiersSerializer.new(dossier) }, pagination: pagination(dossiers) }, status: 200
|
render json: { dossiers: dossiers.map { |dossier| DossiersSerializer.new(dossier) }, pagination: pagination(dossiers) }, status: 200
|
||||||
rescue ActiveRecord::RecordNotFound
|
rescue ActiveRecord::RecordNotFound
|
||||||
render json: {}, status: 404
|
render json: {}, status: 404
|
||||||
end
|
end
|
||||||
|
|
|
@ -7,7 +7,7 @@ class DropDownList < ApplicationRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
def disabled_options
|
def disabled_options
|
||||||
options.select{ |v| (v =~ /^--.*--$/).present? }
|
options.select { |v| (v =~ /^--.*--$/).present? }
|
||||||
end
|
end
|
||||||
|
|
||||||
def selected_options(champ)
|
def selected_options(champ)
|
||||||
|
|
|
@ -46,7 +46,7 @@ class ProcedurePresentation < ApplicationRecord
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
explanatory_types_de_champ = [:header_section, :explication].map{ |k| TypeDeChamp.type_champs.fetch(k) }
|
explanatory_types_de_champ = [:header_section, :explication].map { |k| TypeDeChamp.type_champs.fetch(k) }
|
||||||
|
|
||||||
fields.concat procedure.types_de_champ
|
fields.concat procedure.types_de_champ
|
||||||
.reject { |tdc| explanatory_types_de_champ.include?(tdc.type_champ) }
|
.reject { |tdc| explanatory_types_de_champ.include?(tdc.type_champ) }
|
||||||
|
|
|
@ -18,6 +18,6 @@ class CommentaireFileUploader < BaseUploader
|
||||||
end
|
end
|
||||||
|
|
||||||
def accept_extension_list
|
def accept_extension_list
|
||||||
extension_white_list.map{ |e| ".#{e}" }.join(",")
|
extension_white_list.map { |e| ".#{e}" }.join(",")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -3,7 +3,7 @@ namespace :'2017_07_18_clean_followed_dossiers' do
|
||||||
Follow.where(gestionnaire_id: nil).destroy_all
|
Follow.where(gestionnaire_id: nil).destroy_all
|
||||||
Follow.where(dossier_id: nil).destroy_all
|
Follow.where(dossier_id: nil).destroy_all
|
||||||
|
|
||||||
duplicate_follows = Follow.group('gestionnaire_id', 'dossier_id').count.select{ |_gestionnaire_id_dossier_id, count| count > 1 }.keys
|
duplicate_follows = Follow.group('gestionnaire_id', 'dossier_id').count.select { |_gestionnaire_id_dossier_id, count| count > 1 }.keys
|
||||||
|
|
||||||
duplicate_ids = duplicate_follows.map { |gestionnaire_id, dossier_id| Follow.where(gestionnaire_id: gestionnaire_id, dossier_id: dossier_id).pluck(:id) }
|
duplicate_ids = duplicate_follows.map { |gestionnaire_id, dossier_id| Follow.where(gestionnaire_id: gestionnaire_id, dossier_id: dossier_id).pluck(:id) }
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ require Rails.root.join("lib", "tasks", "task_helper")
|
||||||
namespace :'2017_07_26_clean_birthdate_on_individual' do
|
namespace :'2017_07_26_clean_birthdate_on_individual' do
|
||||||
task clean: :environment do
|
task clean: :environment do
|
||||||
# remove duplicates
|
# remove duplicates
|
||||||
duplicate_individuals = Individual.group("dossier_id").count.select{ |_dossier_id, count| count > 1 }.keys
|
duplicate_individuals = Individual.group("dossier_id").count.select { |_dossier_id, count| count > 1 }.keys
|
||||||
duplicate_individuals.each { |dossier_id| Individual.where(dossier_id: dossier_id, nom: nil).delete_all }
|
duplicate_individuals.each { |dossier_id| Individual.where(dossier_id: dossier_id, nom: nil).delete_all }
|
||||||
|
|
||||||
# Match "" => nil
|
# Match "" => nil
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
namespace :'2017_08_01_clean_assign_to' do
|
namespace :'2017_08_01_clean_assign_to' do
|
||||||
task clean: :environment do
|
task clean: :environment do
|
||||||
duplicates = AssignTo.group(:gestionnaire_id, :procedure_id).count.select{ |_gestionnaire_id_procedure_id, count| count > 1 }.keys
|
duplicates = AssignTo.group(:gestionnaire_id, :procedure_id).count.select { |_gestionnaire_id_procedure_id, count| count > 1 }.keys
|
||||||
|
|
||||||
duplicate_ids = duplicates.map { |gestionnaire_id, procedure_id| AssignTo.where(gestionnaire_id: gestionnaire_id, procedure_id: procedure_id).pluck(:id) }
|
duplicate_ids = duplicates.map { |gestionnaire_id, procedure_id| AssignTo.where(gestionnaire_id: gestionnaire_id, procedure_id: procedure_id).pluck(:id) }
|
||||||
|
|
||||||
|
|
|
@ -134,7 +134,7 @@ describe Admin::ProceduresController, type: :controller do
|
||||||
|
|
||||||
subject { delete :destroy, params: { id: procedure_not_owned.id } }
|
subject { delete :destroy, params: { id: procedure_not_owned.id } }
|
||||||
|
|
||||||
it { expect{ subject }.to raise_error(ActiveRecord::RecordNotFound) }
|
it { expect { subject }.to raise_error(ActiveRecord::RecordNotFound) }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -511,7 +511,7 @@ describe Admin::ProceduresController, type: :controller do
|
||||||
|
|
||||||
subject { get :new_from_existing }
|
subject { get :new_from_existing }
|
||||||
let(:grouped_procedures) { subject; assigns(:grouped_procedures) }
|
let(:grouped_procedures) { subject; assigns(:grouped_procedures) }
|
||||||
let(:response_procedures) { grouped_procedures.map{ |o, procedures| procedures }.flatten }
|
let(:response_procedures) { grouped_procedures.map { |o, procedures| procedures }.flatten }
|
||||||
|
|
||||||
describe 'selecting' do
|
describe 'selecting' do
|
||||||
let!(:large_draft_procedure) { create(:procedure_with_dossiers, dossiers_count: 2) }
|
let!(:large_draft_procedure) { create(:procedure_with_dossiers, dossiers_count: 2) }
|
||||||
|
@ -542,8 +542,8 @@ describe Admin::ProceduresController, type: :controller do
|
||||||
|
|
||||||
it 'groups procedures with services as well as procedures with organisations' do
|
it 'groups procedures with services as well as procedures with organisations' do
|
||||||
expect(grouped_procedures.length).to eq 2
|
expect(grouped_procedures.length).to eq 2
|
||||||
expect(grouped_procedures.find{ |o, p| o == 'DDT des Vosges' }.last).to contain_exactly(procedure_with_service_1)
|
expect(grouped_procedures.find { |o, p| o == 'DDT des Vosges' }.last).to contain_exactly(procedure_with_service_1)
|
||||||
expect(grouped_procedures.find{ |o, p| o == 'DDT du Loiret' }.last).to contain_exactly(procedure_with_service_2, procedure_without_service)
|
expect(grouped_procedures.find { |o, p| o == 'DDT du Loiret' }.last).to contain_exactly(procedure_with_service_2, procedure_without_service)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -5,7 +5,7 @@ describe ApplicationController, type: :controller do
|
||||||
it 'is present' do
|
it 'is present' do
|
||||||
before_actions = ApplicationController
|
before_actions = ApplicationController
|
||||||
._process_action_callbacks
|
._process_action_callbacks
|
||||||
.find_all{ |process_action_callbacks| process_action_callbacks.kind == :before }
|
.find_all { |process_action_callbacks| process_action_callbacks.kind == :before }
|
||||||
.map(&:filter)
|
.map(&:filter)
|
||||||
|
|
||||||
expect(before_actions).to include(:set_raven_context)
|
expect(before_actions).to include(:set_raven_context)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
describe Manager::AdministrateursController, type: :controller do
|
describe Manager::AdministrateursController, type: :controller do
|
||||||
let(:administration){ create(:administration) }
|
let(:administration) { create(:administration) }
|
||||||
|
|
||||||
describe 'POST #create' do
|
describe 'POST #create' do
|
||||||
let(:email) { 'plop@plop.com' }
|
let(:email) { 'plop@plop.com' }
|
||||||
|
|
|
@ -3,7 +3,7 @@ describe NewAdministrateur::AdministrateurController, type: :controller do
|
||||||
it 'is present' do
|
it 'is present' do
|
||||||
before_actions = NewAdministrateur::AdministrateurController
|
before_actions = NewAdministrateur::AdministrateurController
|
||||||
._process_action_callbacks
|
._process_action_callbacks
|
||||||
.find_all{ |process_action_callbacks| process_action_callbacks.kind == :before }
|
.find_all { |process_action_callbacks| process_action_callbacks.kind == :before }
|
||||||
.map(&:filter)
|
.map(&:filter)
|
||||||
|
|
||||||
expect(before_actions).to include(:authenticate_administrateur!)
|
expect(before_actions).to include(:authenticate_administrateur!)
|
||||||
|
|
|
@ -118,7 +118,7 @@ describe NewAdministrateur::ServicesController, type: :controller do
|
||||||
delete :destroy, params: { id: service.id, procedure_id: 12 }
|
delete :destroy, params: { id: service.id, procedure_id: 12 }
|
||||||
end
|
end
|
||||||
|
|
||||||
it { expect{ service.reload }.to raise_error(ActiveRecord::RecordNotFound) }
|
it { expect { service.reload }.to raise_error(ActiveRecord::RecordNotFound) }
|
||||||
it { expect(flash.alert).to be_nil }
|
it { expect(flash.alert).to be_nil }
|
||||||
it { expect(flash.notice).to eq("#{service.nom} est supprimé") }
|
it { expect(flash.notice).to eq("#{service.nom} est supprimé") }
|
||||||
it { expect(response).to redirect_to(services_path(procedure_id: 12)) }
|
it { expect(response).to redirect_to(services_path(procedure_id: 12)) }
|
||||||
|
|
|
@ -412,7 +412,7 @@ describe NewGestionnaire::DossiersController, type: :controller do
|
||||||
subject { delete :purge_champ_piece_justificative, params: { procedure_id: champ.dossier.procedure.id, dossier_id: champ.dossier.id, champ_id: champ.id }, format: :js }
|
subject { delete :purge_champ_piece_justificative, params: { procedure_id: champ.dossier.procedure.id, dossier_id: champ.dossier.id, champ_id: champ.id }, format: :js }
|
||||||
|
|
||||||
context 'when gestionnaire can process dossier' do
|
context 'when gestionnaire can process dossier' do
|
||||||
let(:champ){ create(:champ_piece_justificative, dossier_id: dossier.id, private: true) }
|
let(:champ) { create(:champ_piece_justificative, dossier_id: dossier.id, private: true) }
|
||||||
|
|
||||||
it { is_expected.to have_http_status(200) }
|
it { is_expected.to have_http_status(200) }
|
||||||
|
|
||||||
|
@ -422,7 +422,7 @@ describe NewGestionnaire::DossiersController, type: :controller do
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'but champ is not linked to this dossier' do
|
context 'but champ is not linked to this dossier' do
|
||||||
let(:champ){ create(:champ_piece_justificative, dossier: create(:dossier), private: true) }
|
let(:champ) { create(:champ_piece_justificative, dossier: create(:dossier), private: true) }
|
||||||
|
|
||||||
it { is_expected.to redirect_to(root_path) }
|
it { is_expected.to redirect_to(root_path) }
|
||||||
|
|
||||||
|
@ -434,8 +434,8 @@ describe NewGestionnaire::DossiersController, type: :controller do
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when gestionnaire cannot process dossier' do
|
context 'when gestionnaire cannot process dossier' do
|
||||||
let(:dossier){ create(:dossier, procedure: create(:procedure)) }
|
let(:dossier) { create(:dossier, procedure: create(:procedure)) }
|
||||||
let(:champ){ create(:champ_piece_justificative, dossier_id: dossier.id, private: true) }
|
let(:champ) { create(:champ_piece_justificative, dossier_id: dossier.id, private: true) }
|
||||||
|
|
||||||
it { is_expected.to redirect_to(root_path) }
|
it { is_expected.to redirect_to(root_path) }
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ describe NewGestionnaire::GestionnaireController, type: :controller do
|
||||||
it 'is present' do
|
it 'is present' do
|
||||||
before_actions = NewGestionnaire::GestionnaireController
|
before_actions = NewGestionnaire::GestionnaireController
|
||||||
._process_action_callbacks
|
._process_action_callbacks
|
||||||
.find_all{ |process_action_callbacks| process_action_callbacks.kind == :before }
|
.find_all { |process_action_callbacks| process_action_callbacks.kind == :before }
|
||||||
.map(&:filter)
|
.map(&:filter)
|
||||||
|
|
||||||
expect(before_actions).to include(:authenticate_gestionnaire!)
|
expect(before_actions).to include(:authenticate_gestionnaire!)
|
||||||
|
|
|
@ -5,7 +5,7 @@ describe NewGestionnaire::ProceduresController, type: :controller do
|
||||||
it "is present" do
|
it "is present" do
|
||||||
before_actions = NewGestionnaire::ProceduresController
|
before_actions = NewGestionnaire::ProceduresController
|
||||||
._process_action_callbacks
|
._process_action_callbacks
|
||||||
.find_all{ |process_action_callbacks| process_action_callbacks.kind == :before }
|
.find_all { |process_action_callbacks| process_action_callbacks.kind == :before }
|
||||||
.map(&:filter)
|
.map(&:filter)
|
||||||
|
|
||||||
expect(before_actions).to include(:ensure_ownership!)
|
expect(before_actions).to include(:ensure_ownership!)
|
||||||
|
@ -46,7 +46,7 @@ describe NewGestionnaire::ProceduresController, type: :controller do
|
||||||
it "is present" do
|
it "is present" do
|
||||||
before_actions = NewGestionnaire::ProceduresController
|
before_actions = NewGestionnaire::ProceduresController
|
||||||
._process_action_callbacks
|
._process_action_callbacks
|
||||||
.find_all{ |process_action_callbacks| process_action_callbacks.kind == :before }
|
.find_all { |process_action_callbacks| process_action_callbacks.kind == :before }
|
||||||
.map(&:filter)
|
.map(&:filter)
|
||||||
|
|
||||||
expect(before_actions).to include(:redirect_to_avis_if_needed)
|
expect(before_actions).to include(:redirect_to_avis_if_needed)
|
||||||
|
@ -253,10 +253,10 @@ describe NewGestionnaire::ProceduresController, type: :controller do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'statut' do
|
describe 'statut' do
|
||||||
let!(:a_suivre__dossier) { Timecop.freeze(1.day.ago){ create(:dossier, procedure: procedure, state: Dossier.states.fetch(:en_instruction)) } }
|
let!(:a_suivre__dossier) { Timecop.freeze(1.day.ago) { create(:dossier, procedure: procedure, state: Dossier.states.fetch(:en_instruction)) } }
|
||||||
let!(:new_followed_dossier) { Timecop.freeze(2.days.ago){ create(:dossier, procedure: procedure, state: Dossier.states.fetch(:en_instruction)) } }
|
let!(:new_followed_dossier) { Timecop.freeze(2.days.ago) { create(:dossier, procedure: procedure, state: Dossier.states.fetch(:en_instruction)) } }
|
||||||
let!(:termine_dossier) { Timecop.freeze(3.days.ago){ create(:dossier, procedure: procedure, state: Dossier.states.fetch(:accepte)) } }
|
let!(:termine_dossier) { Timecop.freeze(3.days.ago) { create(:dossier, procedure: procedure, state: Dossier.states.fetch(:accepte)) } }
|
||||||
let!(:archived_dossier) { Timecop.freeze(4.days.ago){ create(:dossier, procedure: procedure, state: Dossier.states.fetch(:en_instruction), archived: true) } }
|
let!(:archived_dossier) { Timecop.freeze(4.days.ago) { create(:dossier, procedure: procedure, state: Dossier.states.fetch(:en_instruction), archived: true) } }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
gestionnaire.followed_dossiers << new_followed_dossier
|
gestionnaire.followed_dossiers << new_followed_dossier
|
||||||
|
|
|
@ -7,7 +7,7 @@ describe NewUser::DossiersController, type: :controller do
|
||||||
it 'are present' do
|
it 'are present' do
|
||||||
before_actions = NewUser::DossiersController
|
before_actions = NewUser::DossiersController
|
||||||
._process_action_callbacks
|
._process_action_callbacks
|
||||||
.find_all{ |process_action_callbacks| process_action_callbacks.kind == :before }
|
.find_all { |process_action_callbacks| process_action_callbacks.kind == :before }
|
||||||
.map(&:filter)
|
.map(&:filter)
|
||||||
|
|
||||||
expect(before_actions).to include(:ensure_ownership!, :ensure_ownership_or_invitation!, :forbid_invite_submission!)
|
expect(before_actions).to include(:ensure_ownership!, :ensure_ownership_or_invitation!, :forbid_invite_submission!)
|
||||||
|
@ -913,8 +913,8 @@ describe NewUser::DossiersController, type: :controller do
|
||||||
subject { delete :purge_champ_piece_justificative, params: { id: champ.dossier.id, champ_id: champ.id }, format: :js }
|
subject { delete :purge_champ_piece_justificative, params: { id: champ.dossier.id, champ_id: champ.id }, format: :js }
|
||||||
|
|
||||||
context 'when dossier is owned by user' do
|
context 'when dossier is owned by user' do
|
||||||
let(:dossier){ create(:dossier, user: user) }
|
let(:dossier) { create(:dossier, user: user) }
|
||||||
let(:champ){ create(:champ_piece_justificative, dossier_id: dossier.id) }
|
let(:champ) { create(:champ_piece_justificative, dossier_id: dossier.id) }
|
||||||
|
|
||||||
it { is_expected.to have_http_status(200) }
|
it { is_expected.to have_http_status(200) }
|
||||||
|
|
||||||
|
@ -924,7 +924,7 @@ describe NewUser::DossiersController, type: :controller do
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'but champ is not linked to this dossier' do
|
context 'but champ is not linked to this dossier' do
|
||||||
let(:champ){ create(:champ_piece_justificative, dossier: create(:dossier)) }
|
let(:champ) { create(:champ_piece_justificative, dossier: create(:dossier)) }
|
||||||
|
|
||||||
it { is_expected.to redirect_to(root_path) }
|
it { is_expected.to redirect_to(root_path) }
|
||||||
|
|
||||||
|
@ -936,8 +936,8 @@ describe NewUser::DossiersController, type: :controller do
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when dossier is not owned by user' do
|
context 'when dossier is not owned by user' do
|
||||||
let(:dossier){ create(:dossier, user: create(:user)) }
|
let(:dossier) { create(:dossier, user: create(:user)) }
|
||||||
let(:champ){ create(:champ_piece_justificative, dossier_id: dossier.id) }
|
let(:champ) { create(:champ_piece_justificative, dossier_id: dossier.id) }
|
||||||
|
|
||||||
it { is_expected.to redirect_to(root_path) }
|
it { is_expected.to redirect_to(root_path) }
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ describe NewUser::UserController, type: :controller do
|
||||||
it 'is present' do
|
it 'is present' do
|
||||||
before_actions = NewUser::UserController
|
before_actions = NewUser::UserController
|
||||||
._process_action_callbacks
|
._process_action_callbacks
|
||||||
.find_all{ |process_action_callbacks| process_action_callbacks.kind == :before }
|
.find_all { |process_action_callbacks| process_action_callbacks.kind == :before }
|
||||||
.map(&:filter)
|
.map(&:filter)
|
||||||
|
|
||||||
expect(before_actions).to include(:authenticate_user!)
|
expect(before_actions).to include(:authenticate_user!)
|
||||||
|
|
|
@ -116,7 +116,7 @@ describe StatsController, type: :controller do
|
||||||
create(:procedure, published_at: Time.zone.now, administrateur: administrateur_4)
|
create(:procedure, published_at: Time.zone.now, administrateur: administrateur_4)
|
||||||
end
|
end
|
||||||
|
|
||||||
let(:association){ Procedure.all }
|
let(:association) { Procedure.all }
|
||||||
|
|
||||||
subject { StatsController.new.send(:procedures_count_per_administrateur, association) }
|
subject { StatsController.new.send(:procedures_count_per_administrateur, association) }
|
||||||
|
|
||||||
|
|
|
@ -14,21 +14,21 @@ RSpec.describe Avis, type: :model do
|
||||||
subject { avis.email_to_display }
|
subject { avis.email_to_display }
|
||||||
|
|
||||||
context 'when gestionnaire is not known' do
|
context 'when gestionnaire is not known' do
|
||||||
it{ is_expected.to eq(invited_email) }
|
it { is_expected.to eq(invited_email) }
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when gestionnaire is known' do
|
context 'when gestionnaire is known' do
|
||||||
let!(:avis) { create(:avis, email: nil, gestionnaire: create(:gestionnaire), dossier: create(:dossier)) }
|
let!(:avis) { create(:avis, email: nil, gestionnaire: create(:gestionnaire), dossier: create(:dossier)) }
|
||||||
|
|
||||||
it{ is_expected.to eq(avis.gestionnaire.email) }
|
it { is_expected.to eq(avis.gestionnaire.email) }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '.by_latest' do
|
describe '.by_latest' do
|
||||||
context 'with 3 avis' do
|
context 'with 3 avis' do
|
||||||
let!(:avis){ create(:avis) }
|
let!(:avis) { create(:avis) }
|
||||||
let!(:avis2){ create(:avis, updated_at: 4.hours.ago) }
|
let!(:avis2) { create(:avis, updated_at: 4.hours.ago) }
|
||||||
let!(:avis3){ create(:avis, updated_at: 3.hours.ago) }
|
let!(:avis3) { create(:avis, updated_at: 3.hours.ago) }
|
||||||
|
|
||||||
subject { Avis.by_latest }
|
subject { Avis.by_latest }
|
||||||
|
|
||||||
|
@ -37,13 +37,13 @@ RSpec.describe Avis, type: :model do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe ".link_avis_to_gestionnaire" do
|
describe ".link_avis_to_gestionnaire" do
|
||||||
let(:gestionnaire){ create(:gestionnaire) }
|
let(:gestionnaire) { create(:gestionnaire) }
|
||||||
|
|
||||||
subject{ Avis.link_avis_to_gestionnaire(gestionnaire) }
|
subject { Avis.link_avis_to_gestionnaire(gestionnaire) }
|
||||||
|
|
||||||
context 'when there are 2 avis linked by email to a gestionnaire' do
|
context 'when there are 2 avis linked by email to a gestionnaire' do
|
||||||
let!(:avis){ create(:avis, email: gestionnaire.email, gestionnaire: nil) }
|
let!(:avis) { create(:avis, email: gestionnaire.email, gestionnaire: nil) }
|
||||||
let!(:avis2){ create(:avis, email: gestionnaire.email, gestionnaire: nil) }
|
let!(:avis2) { create(:avis, email: gestionnaire.email, gestionnaire: nil) }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
subject
|
subject
|
||||||
|
|
|
@ -385,18 +385,18 @@ describe Champ do
|
||||||
context 'and there is a blob' do
|
context 'and there is a blob' do
|
||||||
before { champ.piece_justificative_file.attach(io: StringIO.new("toto"), filename: "toto.txt", content_type: "text/plain") }
|
before { champ.piece_justificative_file.attach(io: StringIO.new("toto"), filename: "toto.txt", content_type: "text/plain") }
|
||||||
|
|
||||||
it { expect{ champ.save }.to change(VirusScan, :count).by(1) }
|
it { expect { champ.save }.to change(VirusScan, :count).by(1) }
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'and there is no blob' do
|
context 'and there is no blob' do
|
||||||
it { expect{ champ.save }.to_not change(VirusScan, :count) }
|
it { expect { champ.save }.to_not change(VirusScan, :count) }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when type_champ is not type_de_champ_piece_justificative' do
|
context 'when type_champ is not type_de_champ_piece_justificative' do
|
||||||
let(:type_de_champ) { create(:type_de_champ_textarea) }
|
let(:type_de_champ) { create(:type_de_champ_textarea) }
|
||||||
|
|
||||||
it { expect{ champ.save }.to_not change(VirusScan, :count) }
|
it { expect { champ.save }.to_not change(VirusScan, :count) }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -95,14 +95,14 @@ describe Gestionnaire, type: :model do
|
||||||
let(:procedure_to_assign) { procedure_3 }
|
let(:procedure_to_assign) { procedure_3 }
|
||||||
|
|
||||||
it { is_expected.to be_truthy }
|
it { is_expected.to be_truthy }
|
||||||
it { expect{ subject }.to change(gestionnaire.procedures, :count) }
|
it { expect { subject }.to change(gestionnaire.procedures, :count) }
|
||||||
end
|
end
|
||||||
|
|
||||||
context "with an already assigned procedure" do
|
context "with an already assigned procedure" do
|
||||||
let(:procedure_to_assign) { procedure }
|
let(:procedure_to_assign) { procedure }
|
||||||
|
|
||||||
it { is_expected.to be_falsey }
|
it { is_expected.to be_falsey }
|
||||||
it { expect{ subject }.not_to change(gestionnaire.procedures, :count) }
|
it { expect { subject }.not_to change(gestionnaire.procedures, :count) }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ describe Invite do
|
||||||
create(:invite, email: email1, dossier: dossier2)
|
create(:invite, email: email1, dossier: dossier2)
|
||||||
end
|
end
|
||||||
|
|
||||||
it { expect{ subject }.to change(Invite, :count).by(2) }
|
it { expect { subject }.to change(Invite, :count).by(2) }
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when an email is invite twice on a dossier' do
|
context 'when an email is invite twice on a dossier' do
|
||||||
|
@ -22,7 +22,7 @@ describe Invite do
|
||||||
create(:invite, email: email1, dossier: dossier1)
|
create(:invite, email: email1, dossier: dossier1)
|
||||||
end
|
end
|
||||||
|
|
||||||
it { expect{ subject }.to raise_error ActiveRecord::RecordInvalid }
|
it { expect { subject }.to raise_error ActiveRecord::RecordInvalid }
|
||||||
end
|
end
|
||||||
|
|
||||||
context "email validation" do
|
context "email validation" do
|
||||||
|
|
|
@ -537,7 +537,7 @@ describe Procedure do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '#default_path' do
|
describe '#default_path' do
|
||||||
let(:procedure){ create(:procedure, libelle: 'A long libelle with àccênts, blabla coucou hello un deux trois voila') }
|
let(:procedure) { create(:procedure, libelle: 'A long libelle with àccênts, blabla coucou hello un deux trois voila') }
|
||||||
|
|
||||||
subject { procedure.default_path }
|
subject { procedure.default_path }
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,7 @@ describe Service, type: :model do
|
||||||
|
|
||||||
context 'of type_organisme' do
|
context 'of type_organisme' do
|
||||||
it 'should belong to the enum' do
|
it 'should belong to the enum' do
|
||||||
expect{ Service.new(params.merge(type_organisme: 'choucroute')) }.to raise_error(ArgumentError)
|
expect { Service.new(params.merge(type_organisme: 'choucroute')) }.to raise_error(ArgumentError)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue