BigW Consortium Gitlab

Commit 36bc2e90 by James Lopez

fix specs

parent ef6a4240
......@@ -158,15 +158,16 @@ class Admin::UsersController < Admin::ApplicationController
user.update_secondary_emails!
end
respond_to do |format|
if result[:status] == :success
format.html { redirect_back_or_admin_user(notice: "Successfully removed email.") }
format.json { head :ok }
else
# restore username to keep form action url.
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] }
end
end
end
protected
......
......@@ -1899,16 +1899,4 @@ describe User, models: true do
user.invalidate_merge_request_cache_counts
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
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