Merge branch 'dev'
This commit is contained in:
commit
b566fca3fb
16 changed files with 69 additions and 39 deletions
|
@ -4,6 +4,7 @@ require:
|
||||||
AllCops:
|
AllCops:
|
||||||
Exclude:
|
Exclude:
|
||||||
- "db/schema.rb"
|
- "db/schema.rb"
|
||||||
|
- "bin/*"
|
||||||
|
|
||||||
Bundler/DuplicatedGem:
|
Bundler/DuplicatedGem:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
|
|
@ -17,7 +17,11 @@ class Users::RegistrationsController < Devise::RegistrationsController
|
||||||
def create
|
def create
|
||||||
user = User.find_by(email: params[:user][:email])
|
user = User.find_by(email: params[:user][:email])
|
||||||
if user.present?
|
if user.present?
|
||||||
UserMailer.new_account_warning(user).deliver_later
|
if user.confirmed?
|
||||||
|
UserMailer.new_account_warning(user).deliver_later
|
||||||
|
else
|
||||||
|
user.resend_confirmation_instructions
|
||||||
|
end
|
||||||
flash.notice = t('devise.registrations.signed_up_but_unconfirmed')
|
flash.notice = t('devise.registrations.signed_up_but_unconfirmed')
|
||||||
redirect_to root_path
|
redirect_to root_path
|
||||||
else
|
else
|
||||||
|
|
|
@ -14,6 +14,7 @@ class GestionnaireDashboard < Administrate::BaseDashboard
|
||||||
updated_at: Field::DateTime,
|
updated_at: Field::DateTime,
|
||||||
current_sign_in_at: Field::DateTime,
|
current_sign_in_at: Field::DateTime,
|
||||||
dossiers: Field::HasMany,
|
dossiers: Field::HasMany,
|
||||||
|
procedures: Field::HasMany
|
||||||
}.freeze
|
}.freeze
|
||||||
|
|
||||||
# COLLECTION_ATTRIBUTES
|
# COLLECTION_ATTRIBUTES
|
||||||
|
@ -29,6 +30,7 @@ class GestionnaireDashboard < Administrate::BaseDashboard
|
||||||
# SHOW_PAGE_ATTRIBUTES
|
# SHOW_PAGE_ATTRIBUTES
|
||||||
# an array of attributes that will be displayed on the model's show page.
|
# an array of attributes that will be displayed on the model's show page.
|
||||||
SHOW_PAGE_ATTRIBUTES = [
|
SHOW_PAGE_ATTRIBUTES = [
|
||||||
|
:procedures,
|
||||||
:dossiers,
|
:dossiers,
|
||||||
:id,
|
:id,
|
||||||
:email,
|
:email,
|
||||||
|
|
|
@ -12,6 +12,7 @@ class ProcedureDashboard < Administrate::BaseDashboard
|
||||||
types_de_champ: TypesDeChampCollectionField,
|
types_de_champ: TypesDeChampCollectionField,
|
||||||
path: ProcedureLinkField,
|
path: ProcedureLinkField,
|
||||||
dossiers: Field::HasMany,
|
dossiers: Field::HasMany,
|
||||||
|
gestionnaires: Field::HasMany,
|
||||||
administrateur: Field::BelongsTo,
|
administrateur: Field::BelongsTo,
|
||||||
id: Field::Number,
|
id: Field::Number,
|
||||||
libelle: Field::String,
|
libelle: Field::String,
|
||||||
|
@ -64,6 +65,7 @@ class ProcedureDashboard < Administrate::BaseDashboard
|
||||||
:for_individual,
|
:for_individual,
|
||||||
:individual_with_siret,
|
:individual_with_siret,
|
||||||
:auto_archive_on,
|
:auto_archive_on,
|
||||||
|
:gestionnaires
|
||||||
].freeze
|
].freeze
|
||||||
|
|
||||||
# FORM_ATTRIBUTES
|
# FORM_ATTRIBUTES
|
||||||
|
|
|
@ -152,33 +152,6 @@ class Gestionnaire < ApplicationRecord
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def valid_couple_table_attr?(table, column)
|
|
||||||
couples = [
|
|
||||||
{
|
|
||||||
table: :dossier,
|
|
||||||
column: :dossier_id
|
|
||||||
},
|
|
||||||
{
|
|
||||||
table: :procedure,
|
|
||||||
column: :libelle
|
|
||||||
},
|
|
||||||
{
|
|
||||||
table: :etablissement,
|
|
||||||
column: :siret
|
|
||||||
},
|
|
||||||
{
|
|
||||||
table: :entreprise,
|
|
||||||
column: :raison_sociale
|
|
||||||
},
|
|
||||||
{
|
|
||||||
table: :dossier,
|
|
||||||
column: :state
|
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|
||||||
couples.include?({ table: table, column: column })
|
|
||||||
end
|
|
||||||
|
|
||||||
def annotations_hash(demande, annotations_privees, avis, messagerie)
|
def annotations_hash(demande, annotations_privees, avis, messagerie)
|
||||||
{
|
{
|
||||||
demande: demande,
|
demande: demande,
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
%td= raison_sociale_or_name(etablissement)
|
%td= raison_sociale_or_name(etablissement)
|
||||||
%tr
|
%tr
|
||||||
%th.libelle SIRET :
|
%th.libelle SIRET :
|
||||||
%td= etablissement.entreprise.siret_siege_social
|
%td= etablissement.siret
|
||||||
%tr
|
%tr
|
||||||
%th.libelle Forme juridique :
|
%th.libelle Forme juridique :
|
||||||
%td= sanitize(etablissement.entreprise.forme_juridique)
|
%td= sanitize(etablissement.entreprise.forme_juridique)
|
||||||
|
|
|
@ -1,4 +1,9 @@
|
||||||
#!/usr/bin/env ruby
|
#!/usr/bin/env ruby
|
||||||
|
begin
|
||||||
|
load File.expand_path('../spring', __FILE__)
|
||||||
|
rescue LoadError => e
|
||||||
|
raise unless e.message.include?('spring')
|
||||||
|
end
|
||||||
APP_PATH = File.expand_path('../config/application', __dir__)
|
APP_PATH = File.expand_path('../config/application', __dir__)
|
||||||
require_relative '../config/boot'
|
require_relative '../config/boot'
|
||||||
require 'rails/commands'
|
require 'rails/commands'
|
||||||
|
|
5
bin/rake
5
bin/rake
|
@ -1,4 +1,9 @@
|
||||||
#!/usr/bin/env ruby
|
#!/usr/bin/env ruby
|
||||||
|
begin
|
||||||
|
load File.expand_path('../spring', __FILE__)
|
||||||
|
rescue LoadError => e
|
||||||
|
raise unless e.message.include?('spring')
|
||||||
|
end
|
||||||
require_relative '../config/boot'
|
require_relative '../config/boot'
|
||||||
require 'rake'
|
require 'rake'
|
||||||
Rake.application.run
|
Rake.application.run
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
#!/usr/bin/env ruby
|
#!/usr/bin/env ruby
|
||||||
|
begin
|
||||||
|
load File.expand_path('../spring', __FILE__)
|
||||||
|
rescue LoadError => e
|
||||||
|
raise unless e.message.include?('spring')
|
||||||
|
end
|
||||||
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
|
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
|
||||||
load Gem.bin_path('rspec-core', 'rspec')
|
load Gem.bin_path('rspec-core', 'rspec')
|
||||||
|
|
17
bin/spring
Executable file
17
bin/spring
Executable file
|
@ -0,0 +1,17 @@
|
||||||
|
#!/usr/bin/env ruby
|
||||||
|
|
||||||
|
# This file loads spring without using Bundler, in order to be fast.
|
||||||
|
# It gets overwritten when you run the `spring binstub` command.
|
||||||
|
|
||||||
|
unless defined?(Spring)
|
||||||
|
require 'rubygems'
|
||||||
|
require 'bundler'
|
||||||
|
|
||||||
|
lockfile = Bundler::LockfileParser.new(Bundler.default_lockfile.read)
|
||||||
|
spring = lockfile.specs.detect { |spec| spec.name == "spring" }
|
||||||
|
if spring
|
||||||
|
Gem.use_paths Gem.dir, Bundler.bundle_path.to_s, *Gem.path
|
||||||
|
gem 'spring', spring.version
|
||||||
|
require 'spring/binstub'
|
||||||
|
end
|
||||||
|
end
|
|
@ -30,7 +30,7 @@ Rails.application.configure do
|
||||||
# Debug mode disables concatenation and preprocessing of assets.
|
# Debug mode disables concatenation and preprocessing of assets.
|
||||||
# This option may cause significant delays in view rendering with a large
|
# This option may cause significant delays in view rendering with a large
|
||||||
# number of complex assets.
|
# number of complex assets.
|
||||||
config.assets.debug = true
|
config.assets.debug = false
|
||||||
|
|
||||||
# Asset digests allow you to set far-future HTTP expiration dates on all assets,
|
# Asset digests allow you to set far-future HTTP expiration dates on all assets,
|
||||||
# yet still be able to expire them through the digest params.
|
# yet still be able to expire them through the digest params.
|
||||||
|
|
|
@ -34,16 +34,34 @@ describe Users::RegistrationsController, type: :controller do
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when the user already exists' do
|
context 'when the user already exists' do
|
||||||
let!(:existing_user) { create(:user, email: email, password: password) }
|
let!(:existing_user) { create(:user, email: email, password: password, confirmed_at: confirmed_at) }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
allow(UserMailer).to receive(:new_account_warning).and_return(double(deliver_later: 'deliver'))
|
allow(UserMailer).to receive(:new_account_warning).and_return(double(deliver_later: 'deliver'))
|
||||||
subject
|
|
||||||
end
|
end
|
||||||
|
|
||||||
it { expect(response).to redirect_to(root_path) }
|
context 'and the user is confirmed' do
|
||||||
it { expect(flash.notice).to eq(I18n.t('devise.registrations.signed_up_but_unconfirmed')) }
|
let(:confirmed_at) { DateTime.now }
|
||||||
it { expect(UserMailer).to have_received(:new_account_warning) }
|
|
||||||
|
before { subject }
|
||||||
|
|
||||||
|
it { expect(response).to redirect_to(root_path) }
|
||||||
|
it { expect(flash.notice).to eq(I18n.t('devise.registrations.signed_up_but_unconfirmed')) }
|
||||||
|
it { expect(UserMailer).to have_received(:new_account_warning) }
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'and the user is not confirmed' do
|
||||||
|
let(:confirmed_at) { nil }
|
||||||
|
|
||||||
|
before do
|
||||||
|
expect_any_instance_of(User).to receive(:resend_confirmation_instructions)
|
||||||
|
subject
|
||||||
|
end
|
||||||
|
|
||||||
|
it { expect(response).to redirect_to(root_path) }
|
||||||
|
it { expect(flash.notice).to eq(I18n.t('devise.registrations.signed_up_but_unconfirmed')) }
|
||||||
|
it { expect(UserMailer).not_to have_received(:new_account_warning) }
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -10,7 +10,6 @@ describe '2018_03_06_clean_html_textareas#clean' do
|
||||||
|
|
||||||
before do
|
before do
|
||||||
Timecop.freeze(champ_date) { champ }
|
Timecop.freeze(champ_date) { champ }
|
||||||
TPS::Application.load_tasks
|
|
||||||
Timecop.freeze(rake_date) { rake_task.invoke }
|
Timecop.freeze(rake_date) { rake_task.invoke }
|
||||||
champ.reload
|
champ.reload
|
||||||
end
|
end
|
||||||
|
|
|
@ -10,7 +10,6 @@ describe '2018_03_29_remove_code_tags_from_mail_templates#clean' do
|
||||||
let!(:dirty_without_continuation_mail) { create(:without_continuation_mail, body: "<h1>Salut</h1><br>Voici ton email avec une balise <code>--balise--</code>") }
|
let!(:dirty_without_continuation_mail) { create(:without_continuation_mail, body: "<h1>Salut</h1><br>Voici ton email avec une balise <code>--balise--</code>") }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
TPS::Application.load_tasks
|
|
||||||
rake_task.invoke
|
rake_task.invoke
|
||||||
dirty_closed_mail.reload
|
dirty_closed_mail.reload
|
||||||
dirty_initiated_mail.reload
|
dirty_initiated_mail.reload
|
||||||
|
|
|
@ -24,8 +24,6 @@ describe '2018_05_14_add_annotation_privee_to_procedure' do
|
||||||
let!(:dossier) { Dossier.create(procedure: procedure, user: user, state: 'brouillon') }
|
let!(:dossier) { Dossier.create(procedure: procedure, user: user, state: 'brouillon') }
|
||||||
let(:rake_task) { Rake::Task['2018_05_14_add_annotation_privee_to_procedure:add'] }
|
let(:rake_task) { Rake::Task['2018_05_14_add_annotation_privee_to_procedure:add'] }
|
||||||
|
|
||||||
before(:all) { TPS::Application.load_tasks }
|
|
||||||
|
|
||||||
before do
|
before do
|
||||||
ENV['PROCEDURE_ID'] = procedure.id.to_s
|
ENV['PROCEDURE_ID'] = procedure.id.to_s
|
||||||
rake_task.invoke
|
rake_task.invoke
|
||||||
|
|
|
@ -69,6 +69,8 @@ end
|
||||||
|
|
||||||
DatabaseCleaner.strategy = :transaction
|
DatabaseCleaner.strategy = :transaction
|
||||||
|
|
||||||
|
TPS::Application.load_tasks
|
||||||
|
|
||||||
SIADETOKEN = :valid_token if !defined? SIADETOKEN
|
SIADETOKEN = :valid_token if !defined? SIADETOKEN
|
||||||
|
|
||||||
include Warden::Test::Helpers
|
include Warden::Test::Helpers
|
||||||
|
|
Loading…
Reference in a new issue