No need to update column as the sign_up process activates the user

This commit is contained in:
simon lehericey 2019-10-24 11:41:01 +02:00
parent 2cb8041560
commit e290fc3674
2 changed files with 5 additions and 4 deletions

View file

@ -66,10 +66,6 @@ class Administrateur < ApplicationRecord
reset_password_token: reset_password_token
})
if administrateur && administrateur.errors.empty?
administrateur.update_column(:active, true)
end
administrateur
end

View file

@ -3,6 +3,7 @@ require 'spec_helper'
feature 'As an administrateur', js: true do
let(:administration) { create(:administration) }
let(:admin_email) { 'new_admin@gouv.fr' }
let(:new_admin) { Administrateur.find_by(email: admin_email) }
before do
perform_enqueued_jobs do
@ -11,6 +12,8 @@ feature 'As an administrateur', js: true do
end
scenario 'I can register' do
expect(new_admin.reload.active?).to be(false)
confirmation_email = open_email(admin_email)
token_params = confirmation_email.body.match(/token=[^"]+/)
@ -20,5 +23,7 @@ feature 'As an administrateur', js: true do
click_button 'Continuer'
expect(page).to have_content 'Mot de passe enregistré'
expect(new_admin.reload.active?).to be(true)
end
end