add administrateur from manager

This commit is contained in:
Christophe Robillard 2020-02-18 16:41:56 +01:00
parent 51f7b41ab4
commit 32d1ebe565
2 changed files with 25 additions and 0 deletions

View file

@ -0,0 +1,13 @@
= form_for([namespace, Administrateur.new(user: User.new)], html: { class: "form" }) do |f|
- if page.resource.errors.any?
#error_explanation
%h2
= t("administrate.form.errors", pluralized_errors: pluralize(page.resource.errors.count, t("administrate.form.error")), resource_name: display_resource_name(page.resource_name))
%ul
- page.resource.errors.full_messages.each do |message|
%li.flash-error= message
- page.attributes.each do |attribute|
%div{ :class => "field-unit field-unit--#{attribute.html_class}" }
= render_field attribute, f: f
.form-actions
= f.submit

View file

@ -1,6 +1,18 @@
describe Manager::AdministrateursController, type: :controller do describe Manager::AdministrateursController, type: :controller do
let(:administration) { create(:administration) } let(:administration) { create(:administration) }
describe 'GET #new' do
render_views
before do
sign_in administration
end
it 'displays form to create a new admin' do
get :new
expect(response).to be_success
end
end
describe 'POST #create' do describe 'POST #create' do
let(:email) { 'plop@plop.com' } let(:email) { 'plop@plop.com' }
let(:password) { 'démarches-simplifiées-pwd' } let(:password) { 'démarches-simplifiées-pwd' }