From fcf5647d5d4cb0612e5172f1bfc9bdf729118dad Mon Sep 17 00:00:00 2001 From: Matt Wean Date: Tue, 20 May 2014 18:14:46 -0700 Subject: [PATCH] Fix admin user creation --- app/admin/admin_user.rb | 4 ++-- spec/features/admin_users_spec.rb | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 spec/features/admin_users_spec.rb 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