add administrateur from manager
This commit is contained in:
parent
51f7b41ab4
commit
32d1ebe565
2 changed files with 25 additions and 0 deletions
13
app/views/manager/administrateurs/_form.html.haml
Normal file
13
app/views/manager/administrateurs/_form.html.haml
Normal 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
|
|
@ -1,6 +1,18 @@
|
|||
describe Manager::AdministrateursController, type: :controller do
|
||||
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
|
||||
let(:email) { 'plop@plop.com' }
|
||||
let(:password) { 'démarches-simplifiées-pwd' }
|
||||
|
|
Loading…
Add table
Reference in a new issue