Merge branch 'dev' into fix-rake-specs

This commit is contained in:
Mathieu Magnin 2018-06-21 11:44:02 +02:00 committed by GitHub
commit 4f93354107
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 34 additions and 35 deletions

View file

@ -17,7 +17,11 @@ class Users::RegistrationsController < Devise::RegistrationsController
def create
user = User.find_by(email: params[:user][:email])
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')
redirect_to root_path
else

View file

@ -14,6 +14,7 @@ class GestionnaireDashboard < Administrate::BaseDashboard
updated_at: Field::DateTime,
current_sign_in_at: Field::DateTime,
dossiers: Field::HasMany,
procedures: Field::HasMany
}.freeze
# COLLECTION_ATTRIBUTES
@ -29,6 +30,7 @@ class GestionnaireDashboard < Administrate::BaseDashboard
# SHOW_PAGE_ATTRIBUTES
# an array of attributes that will be displayed on the model's show page.
SHOW_PAGE_ATTRIBUTES = [
:procedures,
:dossiers,
:id,
:email,

View file

@ -12,6 +12,7 @@ class ProcedureDashboard < Administrate::BaseDashboard
types_de_champ: TypesDeChampCollectionField,
path: ProcedureLinkField,
dossiers: Field::HasMany,
gestionnaires: Field::HasMany,
administrateur: Field::BelongsTo,
id: Field::Number,
libelle: Field::String,
@ -64,6 +65,7 @@ class ProcedureDashboard < Administrate::BaseDashboard
:for_individual,
:individual_with_siret,
:auto_archive_on,
:gestionnaires
].freeze
# FORM_ATTRIBUTES

View file

@ -152,33 +152,6 @@ class Gestionnaire < ApplicationRecord
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)
{
demande: demande,

View file

@ -5,7 +5,7 @@
%td= raison_sociale_or_name(etablissement)
%tr
%th.libelle SIRET :
%td= etablissement.entreprise.siret_siege_social
%td= etablissement.siret
%tr
%th.libelle Forme juridique :
%td= sanitize(etablissement.entreprise.forme_juridique)

View file

@ -30,7 +30,7 @@ Rails.application.configure do
# Debug mode disables concatenation and preprocessing of assets.
# This option may cause significant delays in view rendering with a large
# 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,
# yet still be able to expire them through the digest params.

View file

@ -34,16 +34,34 @@ describe Users::RegistrationsController, type: :controller do
end
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
allow(UserMailer).to receive(:new_account_warning).and_return(double(deliver_later: 'deliver'))
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).to have_received(:new_account_warning) }
context 'and the user is confirmed' do
let(:confirmed_at) { DateTime.now }
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