From 142c661116b3a8190de01e438a4ae84c723bf30f Mon Sep 17 00:00:00 2001 From: Andrew Kvalheim Date: Mon, 12 Sep 2022 10:02:15 -0700 Subject: [PATCH] Add test of admin editing a user Fails with: 1) User admin behaves like admin ability edits a user Failure/Error: raise ActionController::MissingExactTemplate, message ActionController::MissingExactTemplate: Admin::UsersController#edit is missing a template for request formats: text/html re #2975 --- spec/features/user_spec.rb | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/spec/features/user_spec.rb b/spec/features/user_spec.rb index 5644010f37..0bc07888d4 100644 --- a/spec/features/user_spec.rb +++ b/spec/features/user_spec.rb @@ -3,12 +3,24 @@ require 'spec_helper' feature User do + let(:admin) { create(:admin) } + let!(:user) { create(:user) } shared_examples 'admin ability' do - + scenario 'edits a user', feature: true, js: true do + visit admin_users_path + within "tr#user_#{user.id}" do + click_on 'Edit' + end + fill_in 'Name', with: 'Edited Name' + click_button 'Update User' + expect(flash).to include('Updated Edited Name') + end end describe 'admin' do + before { sign_in admin } + it_behaves_like 'admin ability', :admin end end