Delete features unified_login

This commit is contained in:
Xavier J 2016-12-16 14:39:17 +01:00
parent d9dfff3b6a
commit e85cb4c24b
15 changed files with 6 additions and 29 deletions

View file

@ -44,7 +44,7 @@ class Admin::GestionnairesController < AdminController
))
if @gestionnaire.errors.messages.empty?
User.create(attributes) if Features.unified_login
User.create(attributes)
flash.notice = 'Accompagnateur ajouté'
GestionnaireMailer.new_gestionnaire(@gestionnaire.email, @gestionnaire.password).deliver_now!
GestionnaireMailer.new_assignement(@gestionnaire.email, current_administrateur.email).deliver_now!

View file

@ -23,8 +23,8 @@ class Users::SessionsController < Sessions::SessionsController
#POST /resource/sign_in
def create
try_to_authenticate(User)
try_to_authenticate(Gestionnaire) if Features.unified_login
try_to_authenticate(Administrateur) if Features.unified_login
try_to_authenticate(Gestionnaire)
try_to_authenticate(Administrateur)
if user_signed_in?
current_user.update_attributes(loged_in_with_france_connect: '')

View file

@ -6,7 +6,7 @@ class Administrateur < ActiveRecord::Base
has_many :procedures
before_save :ensure_api_token
after_update :sync_credentials, if: -> { Features.unified_login }
after_update :sync_credentials
def ensure_api_token
if api_token.nil?

View file

@ -14,7 +14,7 @@ class Gestionnaire < ActiveRecord::Base
after_create :build_default_preferences_list_dossier
after_create :build_default_preferences_smart_listing_page
after_update :sync_credentials, if: -> { Features.unified_login }
after_update :sync_credentials
def dossiers_follow
@dossiers_follow ||= dossiers.joins(:follows).where("follows.gestionnaire_id = #{id}")

View file

@ -15,7 +15,7 @@ class User < ActiveRecord::Base
delegate :given_name, :family_name, :email_france_connect, :gender, :birthdate, :birthplace, :france_connect_particulier_id, to: :france_connect_information
accepts_nested_attributes_for :france_connect_information
after_update :sync_credentials, if: -> { Features.unified_login }
after_update :sync_credentials
def self.find_for_france_connect email, siret
user = User.find_by_email(email)

View file

@ -1,3 +1,2 @@
remote_storage: false
unified_login: true
opensimplif: false

View file

@ -150,7 +150,6 @@ describe Admin::GestionnairesController, type: :controller do
context 'unified login' do
before do
allow(Features).to receive(:unified_login).and_return(true)
subject
end

View file

@ -12,7 +12,6 @@ describe Gestionnaires::PasswordsController, type: :controller do
let(:administrateur) { create(:administrateur, email: 'unique@plop.com', password: 'password') }
before do
allow(Features).to receive(:unified_login).and_return(true)
@token = gestionnaire.send(:set_reset_password_token)
user # make sure it's created
administrateur # make sure it's created

View file

@ -62,13 +62,11 @@ describe RootController, type: :controller do
render_views
before do
allow(Features).to receive(:unified_login).and_return(true)
subject
end
it "won't have gestionnaire login link" do
expect(response.body).to have_css("a[href='#{new_user_session_path}']")
expect(response.body).to_not have_css("a[href='#{new_gestionnaire_session_path}']")
end
end
end

View file

@ -12,7 +12,6 @@ describe Users::PasswordsController, type: :controller do
let(:administrateur) { create(:administrateur, email: 'unique@plop.com', password: 'password') }
before do
allow(Features).to receive(:unified_login).and_return(true)
@token = user.send(:set_reset_password_token)
gestionnaire # make sure it's created
administrateur # make sure it's created

View file

@ -51,8 +51,6 @@ describe Users::SessionsController, type: :controller do
let(:gestionnaire) { create(:gestionnaire, email: email, password: password) }
let(:administrateur) { create(:administrateur, email: email, password: password) }
before { allow(Features).to receive(:unified_login).and_return(true) }
it 'signs user in' do
post :create, params: {user: {email: user.email, password: user.password}}
expect(@response.redirect?).to be(true)

View file

@ -44,8 +44,6 @@ describe Administrateur, type: :model do
end
context 'unified login' do
before { allow(Features).to receive(:unified_login).and_return(true) }
it 'syncs credentials to associated user' do
administrateur = create(:administrateur)
user = create(:user, email: administrateur.email)

View file

@ -186,8 +186,6 @@ describe Gestionnaire, type: :model do
end
context 'unified login' do
before { allow(Features).to receive(:unified_login).and_return(true) }
it 'syncs credentials to associated user' do
gestionnaire = create(:gestionnaire)
user = create(:user, email: gestionnaire.email)

View file

@ -74,8 +74,6 @@ describe User, type: :model do
end
context 'unified login' do
before { allow(Features).to receive(:unified_login).and_return(true) }
it 'syncs credentials to associated gestionnaire' do
user = create(:user)
gestionnaire = create(:gestionnaire, email: user.email)

View file

@ -13,9 +13,6 @@ describe 'layouts/_navbar.html.haml', type: :view do
render
end
subject { rendered }
it { is_expected.not_to match(/href="\/users\/sign_in">Utilisateur/) }
it { is_expected.to match(/href="\/gestionnaires\/sign_in">Accompagnateur/) }
it { is_expected.not_to match(/href="\/administrateurs\/sign_in">Administrateur/) }
it { is_expected.to match(/Connexion/) }
end
@ -28,9 +25,6 @@ describe 'layouts/_navbar.html.haml', type: :view do
end
subject { rendered }
it { is_expected.not_to match(/href="\/users\/sign_in">Utilisateur/) }
it { is_expected.not_to match(/href="\/gestionnaires\/sign_in">Accompagnateur/) }
it { is_expected.not_to match(/href="\/administrateurs\/sign_in">Administrateur/) }
it { is_expected.to match(/Déconnexion/) }
end
@ -43,9 +37,6 @@ describe 'layouts/_navbar.html.haml', type: :view do
end
subject { rendered }
it { is_expected.not_to match(/href="\/users\/sign_in">Utilisateur/) }
it { is_expected.not_to match(/href="\/gestionnaires\/sign_in">Accompagnateur/) }
it { is_expected.not_to match(/href="\/administrateurs\/sign_in">Administrateur/) }
it { is_expected.to match(/Déconnexion/) }
end