diff --git a/app/admin/admin_user.rb b/app/admin/admin_user.rb index 6d51198..daec5b8 100644 --- a/app/admin/admin_user.rb +++ b/app/admin/admin_user.rb @@ -12,14 +12,14 @@ f.inputs 'User' do f.input :email f.input :password - f.input :password_confirmation + f.input :password_confirmation, required: true end f.actions end controller do def permitted_params - params.permit admin_user: [:email, :password, :password_confirmation] + params.permit(user: [:email, :password, :password_confirmation]) end end end diff --git a/spec/features/admin_users_spec.rb b/spec/features/admin_users_spec.rb new file mode 100644 index 0000000..1fc6e5d --- /dev/null +++ b/spec/features/admin_users_spec.rb @@ -0,0 +1,14 @@ +require 'spec_helper' + +feature 'creating a user' do + scenario 'user creates a new admin user' do + log_in_admin_user + visit new_admin_user_path + fill_in 'Email', with: 'test@example.com' + find('#user_password_confirmation').set('password') + find('#user_password').set('password') + find('input[type="submit"]').click + + expect(current_path).to eq(admin_user_path(AdminUser.find_by(email: 'test@example.com'))) + end +end