Commit 36bc2e90 authored by James Lopez's avatar James Lopez

fix specs

parent ef6a4240
...@@ -158,13 +158,14 @@ class Admin::UsersController < Admin::ApplicationController ...@@ -158,13 +158,14 @@ class Admin::UsersController < Admin::ApplicationController
user.update_secondary_emails! user.update_secondary_emails!
end end
if result[:status] == :success respond_to do |format|
format.html { redirect_back_or_admin_user(notice: "Successfully removed email.") } if result[:status] == :success
format.json { head :ok } format.html { redirect_back_or_admin_user(notice: "Successfully removed email.") }
else format.json { head :ok }
# restore username to keep form action url. else
format.html { redirect_back_or_admin_user(notice: result[:message]) } format.html { redirect_back_or_admin_user(alert: result[:message]) }
format.json { render json: result[:message], status: result[:status] } format.json { render json: result[:message], status: result[:status] }
end
end end
end end
......
...@@ -1899,16 +1899,4 @@ describe User, models: true do ...@@ -1899,16 +1899,4 @@ describe User, models: true do
user.invalidate_merge_request_cache_counts user.invalidate_merge_request_cache_counts
end end
end end
describe 'audit changes' do
let!(:user) { create(:user) }
it 'audits an email change' do
expect { user.update!(email: 'test@example.com') }.to change { AuditEvent.count }.by(1)
end
it 'audits a password change' do
expect { user.update!(password: 'asdfasdf', password_confirmation: 'asdfasdf') }.to change { AuditEvent.count }.by(1)
end
end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment